0
votes

i have a slicer LOB as below:

enter image description here

i have a case where i need to validate if LOB slicer selected value is equal to Life or Medical (it could be both selected), than return true else false.

i tried using selectedvalue but didnt work if 2 values are selected

LOB Selected = if(OR(SELECTEDVALUE('Production Report Treaty'[LOB])="Life",SELECTEDVALUE('Production Report Treaty'[LOB])="Medical"),TRUE,FALSE)

also tried using AllSelected but didnt know to completed it do you know any idea how to do it

2

2 Answers

1
votes

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 function.

So if you have a table like this:

enter image description here

And define a measure like this:

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))))

Then you can check is either one is selected

enter image description here

or not

enter image description here

0
votes

i also was able to do it using the below mesure:

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
) 

regards,