简体   繁体   English

如何在Power BI中的“计算所得”列中使用度量?

[英]How can I use a measure in calculated column in Power BI?

I calculate a quartile in a measure : 我计算四分位数:

 Percentile1_25 = CALCULATE(PERCENTILEX.EXC(DWH;DWH[AREA];0,25);DWH[TYPE_APPART] = "1")

that I want to use in a calculated column : 我想在计算列中使用:

 COL= if(DWH[TYPE_APPART] = "1"; if(DWH[AREA]>[Percentile1_75];"a";"b");"c")

but I have this error : 但我有这个错误:

 "The value of the percentile must be in the range 1 / (N + 1) .. N / (N + 1) included, where N is the number of data values."

Does someone know this error ? 有人知道这个错误吗?

If I put the real value of Percentile1_75 it's ok, but the measure is not accepted. 如果我输入Percentile1_75的真实值可以,但是不接受该度量。

Thx 谢谢

The calculated column is not returning expected result because the measure and the calculated column has a different row context. 计算的列未返回预期结果,因为度量值和计算的列具有不同的行上下文。 You may try to combine both formula into one to avoid such behavior: 您可以尝试将两个公式合并为一个以避免发生这种情况:

ie

column = 
VAR measure = measure formula
RETURN column formula

eg 例如

COL =
VAR Percentile1_25 = CALCULATE(PERCENTILEX.EXC(DWH;DWH[AREA];0,25);DWH[TYPE_APPART] = "1")
RETURN if(DWH[TYPE_APPART] = "1"; if(DWH[AREA]>Percentile1_25;"a";"b");"c")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM