我有以下衡量标准:
AVG Closed Claims =
AVERAGEX (
SUMMARIZE (
fact_Loss,
fact_Loss[ClosedMMYY],
"Average", COUNT ( fact_Loss[ClaimID] )
),
[Average]
)
当ClosedMMYY
为blank
时,我只需要添加过滤器语句以消除值
所以我正在尝试类似的操作:
AVG Closed Claims =
CALCULATE (
AVERAGEX (
SUMMARIZE (
FILTER ( fact_Loss, fact_Loss[ClosedMMYY] <> BLANK () ),
fact_Loss,
fact_Loss[ClosedMMYY],
"Average", COUNT ( fact_Loss[ClaimID] )
),
[Average]
)
)
但这给我一个错误。
此FILTER
应该放在哪里?
答案 0 :(得分:2)
您现在在SUMMARIZE
中有两个表。刚刚使用了过滤后的一个。
AVG Closed Claims =
CALCULATE (
AVERAGEX (
SUMMARIZE (
FILTER ( fact_Loss, fact_Loss[ClosedMMYY] <> BLANK () ),
-- Remove this one => fact_Loss,
fact_Loss[ClosedMMYY],
"Average", COUNT ( fact_Loss[ClaimID] )
),
[Average]
)
)
在上面,您不需要CALCULATE
。如果您使用的是CALCULATE
,请这样写:
AVG Closed Claims =
CALCULATE (
AVERAGEX (
SUMMARIZE (
fact_Loss,
fact_Loss[ClosedMMYY],
"Average", COUNT ( fact_Loss[ClaimID] )
),
[Average]
),
fact_Loss[ClosedMMYY] <> BLANK ()
)
否则,这是
AVG Closed Claims =
AVERAGEX (
SUMMARIZE (
FILTER ( fact_Loss, fact_Loss[ClosedMMYY] <> BLANK () ),
fact_Loss[ClosedMMYY],
"Average", COUNT ( fact_Loss[ClaimID] )
),
[Average]
)
请注意,由于CALCULATE
布尔过滤器替换该列用于过滤上下文,而不仅仅是添加其他条件,因此它们并不完全等效。