简体   繁体   English

当 SQL 中的语句连接多个表时,我有以下情况。 我如何将其转换为 power bi DAX

[英]I have following case when statement in SQL which was joined multiple tables. How can i covert this into power bi DAX

case when A.status = 'ACTIVATED' and m.caller is not null then 'ACTIVE' when A.status = 'ACTIVATED' and m.caller is null and n.callingparty is not null then 'AINACTIVE' when A.status = 'ACTIVATED' and m.caller is null and n.caller is null then 'NO_USAGE' case when A.status = 'ACTIVATED' and m.caller is not null then 'ACTIVE' when A.status = 'ACTIVATED' and m.caller is null and n.callingparty is not null then 'AINACTIVE' when A.status = 'ACTIVATED' 和 m.caller 是 null 和 n.caller 是 null 然后 'NO_USAGE'

Join itself should be resolved by correct relationship in your model inside powerbi.加入本身应通过 powerbi 内的 model 中的正确关系来解决。

then write your measure as:然后将您的度量写为:

MyMeasureName =
SWITCH (
    TRUE (),
    A[Status] = "ACTIVATED"
        && NOT ( ISBLANK ( M[Caller] ) ), "ACTIVE",
    A[Status] = "ACTIVATED"
        && ISBLANK ( M[Caller] )
        && NOT ( ISBLANK ( N[Callingparty] ) ), "AINACTIVE",
    A[Status] = "ACTIVATED"
        && ISBLANK ( M[Caller] )
        && ISBLANK ( N[Callingparty] ), "NO_USAGE",
    "Label for ELSE"
)

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

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