【问题标题】:Power BI - If then and divide by totalPower BI - 如果然后除以总数
【发布时间】:2019-12-06 14:46:35
【问题描述】:

如果可能,我需要 PI Bower 中度量的正确语法。

我想说:

IF(TYR[Status] = 'Active', Sum(Contact_URN))

谢谢

【问题讨论】:

标签: powerbi dax


【解决方案1】:

您可以使用具有以下语法的 IF 来做到这一点:

IF(logical_test>,<value_if_true>, value_if_false) 

喜欢:

IF(TYR[Status] = 'Active';Sum(Contact_URN);BLANK()) 
// remove the BLANK() for the else condition if it is not what you want

或使用具有以下语法的 SWITCH():

SWITCH(<expression>, <value>, <result>)
SWITCH(
    TRUE(),
    TYR[Status] = 'Active'; SUM(Contact_URN)
    // insert other conditions here if needed   
)

如果这不起作用,请提供有关您的字段和表格的更多详细信息。

【讨论】:

    【解决方案2】:

    根据您的示例,您正在寻找的度量的正确语法是:

    Your Measure = Calculate(Sum(Contact_URN); Filter(TYR; TYR[Status] = "Active"))
    

    如果度量中的条件是过滤器。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-01-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-20
      • 2021-10-03
      • 1970-01-01
      相关资源
      最近更新 更多