计算DAX中度量的最大值

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

Calculating Max value of a measure in DAX

问题

以下是已翻译的内容:

DAX which I tried:
我尝试的 DAX 公式:

DAX for Pareto%*
用于 Pareto%* 的 DAX 公式:

Pareto%* =
MAXX(ALL(EventDetail[TimelinessBreak]),[RunningTotal*])
Pareto%* =
MAXX(ALL(EventDetail[TimelinessBreak]),[RunningTotal*])

Can anyone please suggest what is wrong with the above DAX.
请问有人能否建议上述 DAX 公式有什么问题。

DAX suggested by Marcus returning 3587177 which is incorrect.
Marcus 建议的 DAX 返回的是 3587177,这是不正确的。

Test34* =
Test34* =

CALCULATE (
CALCULATE (
[RunningTotal*] ,
[RunningTotal*] ,
ALL ( EventDetail )
ALL ( EventDetail )
)
)

Description for [RunningTotal*]
[RunningTotal*] 的说明:

CALCULATE(
CALCULATE(
[ActualUpdates],
[ActualUpdates],
FILTER(
FILTER(
CALCULATETABLE(
CALCULATETABLE(
SUMMARIZE(
SUMMARIZE(
'EventDetail',
'EventDetail',
'EventDetail'[TimelinessBreakSort],
'EventDetail'[TimelinessBreakSort],
'EventDetail'[TimelinessBreak]
'EventDetail'[TimelinessBreak]
),
),
ALLSELECTED('EventDetail')
ALLSELECTED('EventDetail')
),
),
ISONORAFTER(
ISONORAFTER(
'EventDetail'[TimelinessBreakSort], MAX('EventDetail'[TimelinessBreakSort]), DESC,
'EventDetail'[TimelinessBreakSort], MAX('EventDetail'[TimelinessBreakSort]), DESC,
'EventDetail'[TimelinessBreak], MAX('EventDetail'[TimelinessBreak]), DESC
'EventDetail'[TimelinessBreak], MAX('EventDetail'[TimelinessBreak]), DESC
)
)
)

If I remove the timelinessbreak column from the table it is showing correct output with my DAX.
如果我从表格中移除 timelinessbreak 列,我的 DAX 公式会显示正确的输出。

英文:

I Need to calculate the Max value from a measure. Below is the scenario.

计算DAX中度量的最大值

Expectation : Pareto%* column should return max value from RunningTotal* Measure which is 1982. Each row in Pareto%* should return 1982.

DAX which I tried:

DAX for Pareto%*

Pareto%* = 

MAXX(ALL(EventDetail[TimelinessBreak]),[RunningTotal*])

Can anyone please suggest what is wrong with the above DAX.

[![enter image description here][2]][2]

DAX suggested by Marcus returning 3587177 which is incorrect.

Test34* =
CALCULATE (
[RunningTotal*] ,
ALL ( EventDetail )
)

计算DAX中度量的最大值

Description for [RunningTotal*]

CALCULATE(
[ActualUpdates],
FILTER(
	CALCULATETABLE(
		SUMMARIZE(
			'EventDetail',
			'EventDetail'[TimelinessBreakSort],
			'EventDetail'[TimelinessBreak]
		),
		ALLSELECTED('EventDetail')
	),
	ISONORAFTER(
		'EventDetail'[TimelinessBreakSort], MAX('EventDetail'[TimelinessBreakSort]), DESC,
		'EventDetail'[TimelinessBreak], MAX('EventDetail'[TimelinessBreak]), DESC
	)
)

)

If I remove the timelinessbreak column from the table it is showing correct output with my DAX.

答案1

得分: 2

以下是已翻译的代码部分:

With the added information, I suggest:

``` Pareto%* =
MAXX (
    SUMMARIZE (
        ALL ( EventDetail ) ,
        EventDetail[TimelinessBreak] ,
        EventDetail[TimelinessBreakSort]
    ) ,
    [RunningTotal*]
)

You can also try this (like your original measure), which is a bit more compact:

MAXX (
    ALL (
        EventDetail[TimelinessBreak] ,
        EventDetail[TimelinessBreakSort]
    ) ,
    [RunningTotal*]
)

<details>
<summary>英文:</summary>

With the added information, I suggest:

Pareto%* =
MAXX (
SUMMARIZE (
ALL ( EventDetail ) ,
EventDetail[TimelinessBreak] ,
EventDetail[TimelinessBreakSort]
) ,
[RunningTotal*]
)


You can also try this (like your original measure), which is a bit more compact:

Pareto%* =
MAXX (
ALL (
EventDetail[TimelinessBreak] ,
EventDetail[TimelinessBreakSort]
) ,
[RunningTotal*]
)



</details>



# 答案2
**得分**: 1

尝试:

我可能弄错了,不过根据你对*RunningTotal*的定义,你可能需要在这里使用`SUMMARIZE`:

```excel
=VAR T1 =
    SUMMARIZE(
        ALLSELECTED( EventDetail ),
        EventDetail[TimelinessBreak],
        "Running Total", [RunningTotal*]
    )
RETURN
    MAXX(
        T1,
        [Running Total]
    )
英文:

Try:

I might be mistaken, though due to your definition of RunningTotal* you may have to use SUMMARIZE here:

=VAR T1 =
    SUMMARIZE(
        ALLSELECTED( EventDetail ),
        EventDetail[TimelinessBreak],
        &quot;Running Total&quot;, [RunningTotal*]
    )
RETURN
    MAXX(
        T1,
        [Running Total]
    )

huangapple
  • 本文由 发表于 2023年2月8日 17:59:50
  • 转载请务必保留本文链接:https://go.coder-hub.com/75384081.html
匿名

发表评论

匿名网友

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

确定