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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Using multiple slicers in a Measure

Hi,

Here is what I have and want to achieve:

1) I have a table with a category column

2) Then I have multiple slicers related to each category in the category column

3) Now I want to write a Measure which is like : If user selects anything from Category A slicer then the Measure calculates a formula and only updates that particular row.

4) Now when the user selects anything from Category B slicer then the Measure calculates a formula and only updates that particular row.

 

This is what I tried :

Measure = SWITCH(
TRUE(),
[Category_A_selection]<>0,CALCULATE([Category_A_formula],'Sample Data'[Category]="Category A"),
[Category_B_selection]<>0,CALCULATE([Category_B_formula],'Sample Data'[Category]="Category B"), sum('Sample Data'[another_column]))

 

The problem with this it only shows the result in the Category A measure  and nothing comes up in Category B Measure. Also whatever is selected in Category A slicer that value only shows up in Category B slicer.

3 REPLIES 3
v-kkf-msft
Community Support
Community Support

Hi @Anonymous ,

 

I am not sure if I understood your question correctly. My output is that if the value in the slicer is not 0, then calculate value for category A and category B.

 

Measure = 
VAR A =
    CALCULATE (
        [Category_A_formula],
        FILTER ( 'Sample Data', 'Sample Data'[Category] = "Category A" )
    )
VAR B =
    CALCULATE (
        [Category_B_formula],
        FILTER ( 'Sample Data', 'Sample Data'[Category] = "Category B" )
    )
RETURN
    SWITCH (
        TRUE (),
        [Category_A_selection] <> 0
            && [Category_B_selection] <> 0, A + B,
        [Category_A_selection] <> 0, A,
        [Category_B_selection] <> 0, B,
        SUM ( 'Sample Data'[another_column] )
    )

vkkfmsft_0-1652856635707.png

vkkfmsft_1-1652856650085.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , I think you need two slicers on same column try

 

Compare Categorical Data Using Slicers - Compare two Brands: https://youtu.be/exN4nTewgbc

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thanks @amitchandak for sharing the video link. Very well explained. In the video you are adding the measures as different columns in the table. I need to have one Measure which calculates for each row based on what category it is and what slicer is selected.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.