检索每个类别的最大值失败

huangapple go评论65阅读模式
英文:

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'[项目])),
    [单价])
英文:

want to clear that the first answer is already work, hereby just add another formula for your reference.

if you want to use MAXX, try this one:

    Max of Unit Price = 
    MAXX(FILTER('Table1',[project]=EARLIER('Table1'[project])),
    [unit price])

检索每个类别的最大值失败

huangapple
  • 本文由 发表于 2023年4月20日 02:20:06
  • 转载请务必保留本文链接:https://go.coder-hub.com/76057706.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定