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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
cruzp
Helper V
Helper V

3 slicer selection to show different measure with option to show Both

 

Hello Team, 

I have a chart below:

cruzp_1-1723709684145.png

 

Is it possible to have a slicer named "Closed Lost"?

That slicer will have 3 selections such as:

Both - to show both Closed Lost and Closed Won (both will appear standing next to each other)
Yes - to show only Closed Lost (red bar)
No - to show only Closed Won (green bar)

 

Is that something doable?

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @cruzp 

You can achieve this by using a disconnected table that holds the slicer values and a measure to return the slicer selection.

Sum of Value = 
VAR _SLICER =
    SELECTEDVALUE ( Slicer[Slicer], "Both" )
RETURN
    SWITCH (
        _SLICER,
        "Both", SUM ( Data[Value] ),
        "Win", CALCULATE ( SUM ( Data[Value] ), KEEPFILTERS ( Data[Category] = "Win" ) ),
        "Loss", CALCULATE ( SUM ( Data[Value] ), KEEPFILTERS ( Data[Category] = "Loss" ) )
    )

danextian_0-1723723557671.png

Please see attached pbix for details.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

18 REPLIES 18
danextian
Super User
Super User

Hi @cruzp 

You can achieve this by using a disconnected table that holds the slicer values and a measure to return the slicer selection.

Sum of Value = 
VAR _SLICER =
    SELECTEDVALUE ( Slicer[Slicer], "Both" )
RETURN
    SWITCH (
        _SLICER,
        "Both", SUM ( Data[Value] ),
        "Win", CALCULATE ( SUM ( Data[Value] ), KEEPFILTERS ( Data[Category] = "Win" ) ),
        "Loss", CALCULATE ( SUM ( Data[Value] ), KEEPFILTERS ( Data[Category] = "Loss" ) )
    )

danextian_0-1723723557671.png

Please see attached pbix for details.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hi @danextian , we are almost there! just a quick question, why am i getting blank when 'Both' is selected as filter? the blank is the value without the condition (won/lost) 

i wonder if its because the stage_name is coming from a different table

cruzp_0-1723725390372.png

 

Both categories are supposed to show  when both is selected from the salaries and not an extra column showing the sum of both categories. Did you use the category column from your fact table as the legend or the slicer's? There also shouldn't be a relationship between slicer and fact the slicer being a disconnected table. Please check again on my sample  file. I can't think of anything else other than that as there may be other factors in your model that is causing this.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

@danextian i think because the category i am using is a filtered column from power query, so it naturally shows blank. I can just exclude the blank and it would solve the issue. THANK YOU A LOT!

mostho
Helper II
Helper II

1. if closed won and closed lost are columns, define two measure (sum('closed lost') and sum('closed won') - if they are already measures you can skip this step.
2. define a field parameter with the two measures:

 

Parameter = {
    ("won", NAMEOF('Data'[msWon]), 0),
    ("lost", NAMEOF('Data'[msClosed]), 1)
}

 

3. use this parameter in the graph and in the slicer:

a_param.jpg

a_graph.jpg

Hi @mostho , 

cruzp_0-1723715559988.png

 

Showing errors. 

@mostho ,

cruzp_3-1723717360549.png

cruzp_4-1723717372778.png

 

not showing properly.

 

 

 

You do not use the parameter in the graph as y-axis. look at my example to understand this

@mostho hi, you are actually using it in column y-axis and it works fine in your report. however, if i apply it in my report, it does not show same.

 

your report:

cruzp_1-1723720253117.png

 

mine:

cruzp_2-1723720283196.png

 

i create the parameter table by simply "New Table"

 

i said define a field parameter with the two measures, not a table.

parameter.jpg

@mostho it worked, thank you. is there a way to customize colors like for example if i select Won, the color would be Green, if Lost is selected, then it would be Red. Is that doable?

yes, it is:

colors.jpg

You can set color and transparency per column.

@mostho is there a way to prevent showing one color if only one measure is selected in the slilcer?

 

the colors works when both measure in sllicer is selected, however if you select either one of them, it shows similar color, and you only have "All" option in the formatting color.

it seems to be an issue with column charts, if there is only one column selected then this setting dialog switches to a-"category"-settings dialog. with a line chart for example the colors stay the same (in my observation).

Does that mean I cant change the color when one is selected?

Try it.

If only one field in the slicer is selected, the settings changes to a category-setting:

colors2.jpg

> Showing errors.

Well just posting a screenshot with an error message and not saying what you have done and how your data model looks like makes it really hard to help.

Anyway: here is my minimal working example, maybe you can see the difference to yours.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors