如何使用dax根据给定值执行转换

How to perform a conversion based on a given value using dax

我正在尝试根据不同的列值(电子邮件)除以执行的交易(客户)数量来创建转换。

我试过指出计算列中电子邮件的公式。

emailConversionRate = 
  DIVIDE ( 
   DISTINCTCOUNT ( 
    ClientTransView[TransEntityID]
 ), 
   Count( Interactions[chaneltype='email'
  )
)

我希望输出是实体 ID 的数量除以所使用的渠道类型。

您可以尝试使用 CALCULATE 函数过滤 chaneltype 并对电子邮件使用双引号,因为它必须是字符串。

emailConversionRate =
    DIVIDE (
        DISTINCTCOUNT ( ClientTransView[TransEntityID] ),
        CALCULATE (
            COUNT ( Interactions[chaneltype] ),
            Interactions[chaneltype] = "email"
        )
    )