cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Multi-select slicer: how to set card to 0 for values that aren't selected

I have three cards, each showing a different total (for the number of clients who have received different services). The cards correspond to the categories in a slicer, and the slicer has to be multi-select. My client wants to the cards to show a 0 if the slicer value is not selected and the corresponding total if the value is selected.

I had a version of this that worked, but only because I set the slicer to single-select. When I change the slicer to multi-select and select more than 1 option, the cards all show 0.

Here's an example for one of the three cards that works with a single-select slicer but not with the multi-select slicer that I need. 

 

demo_total_training_consulting =
    VAR _service_type_selector = SELECTEDVALUE('aec_surveys Participants'[service_type], "All")
    RETURN
        SWITCH(TRUE(),
        _service_type_selector = "Training & Consulting", [service_total_training_consulting],
        0)
 

Is it possible to achieve what my client wants?

1 ACCEPTED SOLUTION
v-eqin-msft
Community Support
Community Support

Hi @Anonymous ,

 

According to your statement, I think your issue should be caused by "All" in SELECTEDVALUE(). 

The logic of SELECTEDVALUE('aec_surveys Participants'[service_type], "All") is when you selected multiple values or not select value it will return "All". 

Here I suggest you to try code as below to achieve your goal.

demo_total_training_consulting =
VAR _service_type_selector =
    VALUES ( 'aec_surveysParticipants'[service_type] )
RETURN
    IF(
        ISFILTERED('aec_surveys Participants'[service_type]),
        IF(
            "Training & Consulting" in _service_type_selector,                                                                                
            [service_total_training_consulting]),0),
        0
        )

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Thanks for your help, @v-eqin-msft ! I was re-using some code without really thinking through what it meant. 

I was successful using a portion of your suggestion:

demo_total_training_consulting =
VAR _service_type_selector =
    VALUES ( 'aec_surveys Participants'[service_type] )
RETURN
        IF(
            "Training & Consulting" in _service_type_selector,                                                                                
            [service_total_training_consulting], 0)


v-eqin-msft
Community Support
Community Support

Hi @Anonymous ,

 

According to your statement, I think your issue should be caused by "All" in SELECTEDVALUE(). 

The logic of SELECTEDVALUE('aec_surveys Participants'[service_type], "All") is when you selected multiple values or not select value it will return "All". 

Here I suggest you to try code as below to achieve your goal.

demo_total_training_consulting =
VAR _service_type_selector =
    VALUES ( 'aec_surveysParticipants'[service_type] )
RETURN
    IF(
        ISFILTERED('aec_surveys Participants'[service_type]),
        IF(
            "Training & Consulting" in _service_type_selector,                                                                                
            [service_total_training_consulting]),0),
        0
        )

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Join Arun Ulag at MPPC23

Join Arun Ulag at MPPC23

Get a sneak peek into this year's Power Platform Conference Keynote.

PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Top Solution Authors