获取 power bi 切片器中选定值的值
Get value of selected values in power bi slicer
我有一个切片器 LOB,如下所示:
我有一个情况,我需要验证 LOB 切片器选择的值是否等于生命或医疗(可以同时选择),而不是 return true else false。
我尝试使用 selectedvalue,但如果选择了 2 个值则不起作用
LOB Selected = if(OR(SELECTEDVALUE('Production Report Treaty'[LOB])="Life",SELECTEDVALUE('Production Report Treaty'[LOB])="Medical"),TRUE,FALSE)
也尝试过使用 AllSelected 但不知道如何完成
你知道怎么做吗
SELECTEDVALUE will give you a result only when there is a single value selected in the slicer. If you want to find if Life
or Medial
is selected, then you can look at the contents of the underlying table. It will be filtered to include only rows with values as specified in the slicer. So if Life
is selected, then you will find a row with value Life
in the table. The same with Medical
. And also you may want to check is there is any value selected in the slicer or not by using ISFILTERED 函数。
所以如果你有这样的table:
并像这样定义一个度量:
Life or Medical Selected =
var LifeSelected = COUNTAX(FILTER(LOB_Table; LOB_Table[LOB] = "Life"); [LOB])
var MedicalSelected = COUNTAX(FILTER(LOB_Table; LOB_Table[LOB] = "Medical"); [LOB])
RETURN AND(ISFILTERED(LOB_Table[LOB]);OR(NOT(ISBLANK(LifeSelected)); NOT(ISBLANK(MedicalSelected))))
然后您可以检查是否选择了其中一个
是否
我也可以使用以下方法做到这一点:
LOB Selected =
if(
(
SELECTEDVALUE('Production Report Treaty'[LOB])="Life" ||
SELECTEDVALUE('Production Report Treaty'[LOB])="Medical" ||
CONCATENATEX(ALLSELECTED('Production Report Treaty'[LOB]),'Production Report Treaty'[LOB], ", ") = "Medical, Life")
,True
,False
)
问候,
我有一个切片器 LOB,如下所示:
我有一个情况,我需要验证 LOB 切片器选择的值是否等于生命或医疗(可以同时选择),而不是 return true else false。
我尝试使用 selectedvalue,但如果选择了 2 个值则不起作用
LOB Selected = if(OR(SELECTEDVALUE('Production Report Treaty'[LOB])="Life",SELECTEDVALUE('Production Report Treaty'[LOB])="Medical"),TRUE,FALSE)
也尝试过使用 AllSelected 但不知道如何完成 你知道怎么做吗
SELECTEDVALUE will give you a result only when there is a single value selected in the slicer. If you want to find if Life
or Medial
is selected, then you can look at the contents of the underlying table. It will be filtered to include only rows with values as specified in the slicer. So if Life
is selected, then you will find a row with value Life
in the table. The same with Medical
. And also you may want to check is there is any value selected in the slicer or not by using ISFILTERED 函数。
所以如果你有这样的table:
并像这样定义一个度量:
Life or Medical Selected =
var LifeSelected = COUNTAX(FILTER(LOB_Table; LOB_Table[LOB] = "Life"); [LOB])
var MedicalSelected = COUNTAX(FILTER(LOB_Table; LOB_Table[LOB] = "Medical"); [LOB])
RETURN AND(ISFILTERED(LOB_Table[LOB]);OR(NOT(ISBLANK(LifeSelected)); NOT(ISBLANK(MedicalSelected))))
然后您可以检查是否选择了其中一个
是否
我也可以使用以下方法做到这一点:
LOB Selected =
if(
(
SELECTEDVALUE('Production Report Treaty'[LOB])="Life" ||
SELECTEDVALUE('Production Report Treaty'[LOB])="Medical" ||
CONCATENATEX(ALLSELECTED('Production Report Treaty'[LOB]),'Production Report Treaty'[LOB], ", ") = "Medical, Life")
,True
,False
)
问候,