英文:
Retrieving max value per category fails
问题
I'm attempting to retrieve the max unit price per category (Project) but it always returns the min value. Any help or feedback regarding how to return the max value is greatly appreciated.
Dax attempt:
Max of Unit Price max per Project =
MAXX(
KEEPFILTERS(VALUES('Table1'[Project])),
CALCULATE(MAX('Table1'[Unit Price]))
)
The data example below consists of a single category (column not shown). The max value should be 3.58 but is instead 1.79.
Data example and output:
英文:
I'm attempting to retrieve the max unit price per category (Project) but it always returns the min value. Any help or feedback regarding how to return the max value is greatly appreciated.
Dax attempt:
Max of Unit Price max per Project =
MAXX(
KEEPFILTERS(VALUES('Table1'[Project])),
CALCULATE(MAX('Table1'[Unit Price]))
)
The data example below consists of a single category (column not shown). The max value should be 3.58 but is instead 1.79.
Data example and output:
答案1
得分: 1
要按类别获取最大值,可以使用以下DAX,
单价的最大值 = CALCULATE (
MAX ( 'Sheet1'[Unit price]),
ALLEXCEPT ( 'sheet1', 'sheet1'[Category] ))
英文:
For getting the max value per category, you can use the below DAX,
Max of Unit Price = CALCULATE (
MAX ( 'Sheet1'[Unit price]),
ALLEXCEPT ( 'sheet1', 'sheet1'[Category] ))
答案2
得分: 1
想要澄清第一个答案已经有效,现在只是为您的参考添加另一个公式。
如果您想使用 MAXX,请尝试这个:
最大单位价格 =
MAXX(FILTER('Table1',[项目]=EARLIER('Table1'[项目])),
[单价])
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论