Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Deemo
Helper II
Helper II

Dynamic measure based on a slicer with muti select option

Hello,

Need your help creating a measure which will be based on a slicer with multiple selection

 

Eg:

We have one disconnected "Labels" table where we have list of values as shown below and which will be used as a slicer.

Labels
Tag1
dynamicparam
core
custom
businessflow
subflow

 

I have another table "Function" which contains these labels as comma separated as shown below

NameLables
Function1Tag1,dynamicparam,core
Function2Tag1,businessflow,core
Function3custom,dynamicparam
Function4custom,dynamicparam
Function5custom,businessflow,subflow

 

Need to create a measure which will be able to mark 1,0 if the labels selected from slicer "Label" is present in comma separated values. User can select multiple labels as well. 

 

For example, If I select "businessflow" and "custom" from the list then result should be 

NameLablesMeasure
Function1Tag1,dynamicparam,core0
Function2Tag1,businessflow,core1
Function3custom,dynamicparam1
Function4custom,dynamicparam1
Function5custom,businessflow,subflow1

 

If I select "businessflow" from the list then result should be 

NameLablesMeasure
Function1Tag1,dynamicparam,core0
Function2Tag1,businessflow,core1
Function3custom,dynamicparam0
Function4custom,dynamicparam0
Function5custom,businessflow,subflow1

 

This measure will be used as a filter for other visuals

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Deemo 

you may try

Measure1 =
VAR CurrentLabel =
    SELECTEDVALUE ( Function[Labels] )
RETURN
    NOT ISEMPTY (
        FILTER (
            ALLSELECTED ( Labels ),
            CONTAINSSTRING ( CurrentLabel, Labels[Labels] )
        )
    )

View solution in original post

3 REPLIES 3
tamerj1
Super User
Super User

Hi @Deemo 

you may try

Measure1 =
VAR CurrentLabel =
    SELECTEDVALUE ( Function[Labels] )
RETURN
    NOT ISEMPTY (
        FILTER (
            ALLSELECTED ( Labels ),
            CONTAINSSTRING ( CurrentLabel, Labels[Labels] )
        )
    )

Thank you so much.. It does work 🙂 I am unable to understand the DAX though .. Isn't selectedvalue is for single selection?

@Deemo 

Yes. That is the value of the current filter context which we use it to filter ALLSELCTED ( Labels )

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

July Newsletter

Fabric Community Update - July 2024

Find out what's new and trending in the Fabric Community.