如何创建带有逗号分隔的多个值的动态卡

时间:2019-03-14 22:35:58

标签: powerbi dax powerbi-desktop

如果在切片器中选择了所有用户,则卡应显示“所有用户”,否则用逗号分隔用户

我在下面创建了度量,但是当我选择多个用户时,该卡将显示“所有用户”,而不是用逗号隔开

User = VAR UserName1 = SELECTEDVALUE(dim_User[Name_FirstLast]) 
RETURN
        "Actions for " & IF(ISBLANK(UserName1), "All Users",
CONCATENATEX ( VALUES(dim_User[Name_FirstLast]), UserName1, "," ))

enter image description here

应该是这样的:

enter image description here

1 个答案:

答案 0 :(得分:2)

如果您有多项选择,SELECTEDVALUE函数将返回空白。

代替定义变量,请尝试如下操作:

User = "Actions for " &
    IF(
        ISFILTERED( dim_User[Name_FirstLast] ),
        CONCATENATEX ( VALUES(dim_User[Name_FirstLast]), dim_User[Name_FirstLast], "," ),
        "All Users"
    )