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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
dofrancis3
Resolver I
Resolver I

Slicer based on Mesure

Dear Colleagues, Please i need your suport ! I would like to create a Slicer which can allow me to display “only Green chart” or “only Red chart” or two of them "red and Green). Below is my conditional mesure and the result of my bar chart: Bar_chart_Couleur = IF( [%_Pop] > [%_Target], "Green", "Red")

 

dofrancis3_0-1716894954169.png

 

3 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi @dofrancis3 ,

The Table data is shown below:

vzhouwenmsft_0-1716948669559.png

Please follow these steps:
1.Enter the following data manually.

vzhouwenmsft_1-1716948778800.png

 

vzhouwenmsft_2-1716948792422.png

2.Use the following DAX expression to create a measure('sumValue' and 'target' correspond to your ' [%_Pop]' and '[%_Target]' respectively)

Measure = 
VAR _a = SELECTEDVALUE('Table (2)'[Column1])
RETURN 
SWITCH(TRUE(),
_a = "red",IF([sumValue] <= [target] ,[sumValue],BLANK()),
_a = "green",IF([sumValue] > [target] , [sumValue] , BLANK()),
[sumValue])

3.Final output

vzhouwenmsft_3-1716948950561.png

vzhouwenmsft_4-1716948966809.png

 

 Best Regards,
Wenbin 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

xifeng_L
Super User
Super User

@Anonymous 

Your answers are excellent! And I would like to share some additional solutions below.

 

 

@dofrancis3 

You can try below solution.

 

step1. create a calculated table and use to slicer.

 

xifeng_L_0-1716973064215.png

ShowType = SELECTCOLUMNS({("Green",1),("Red",2),("Both",3)},"Type",[Value1],"Index",[Value2])

 

step2. create a measure and use to visual filter.

 

xifeng_L_1-1716973182678.png

Show Control = IF(NOT ISEMPTY(INTERSECT(VALUES('ShowType'[Type]),{[Bar_chart_Couleur],"Both"})),1,0)

 

The result as follow:

 

xifeng_L_3-1716973282503.png

xifeng_L_4-1716973294626.png

xifeng_L_5-1716973308439.png

 

 

Demo - Slicer based on Mesure.pbix

 

 

Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !

 

Thank you~

 

View solution in original post

Dear Colleagues!

I'd like to thank you for your contribution to my request above.
All your different solutions worked perfectly.
Thank you again.

View solution in original post

3 REPLIES 3
xifeng_L
Super User
Super User

@Anonymous 

Your answers are excellent! And I would like to share some additional solutions below.

 

 

@dofrancis3 

You can try below solution.

 

step1. create a calculated table and use to slicer.

 

xifeng_L_0-1716973064215.png

ShowType = SELECTCOLUMNS({("Green",1),("Red",2),("Both",3)},"Type",[Value1],"Index",[Value2])

 

step2. create a measure and use to visual filter.

 

xifeng_L_1-1716973182678.png

Show Control = IF(NOT ISEMPTY(INTERSECT(VALUES('ShowType'[Type]),{[Bar_chart_Couleur],"Both"})),1,0)

 

The result as follow:

 

xifeng_L_3-1716973282503.png

xifeng_L_4-1716973294626.png

xifeng_L_5-1716973308439.png

 

 

Demo - Slicer based on Mesure.pbix

 

 

Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !

 

Thank you~

 

Anonymous
Not applicable

Hi @dofrancis3 ,

The Table data is shown below:

vzhouwenmsft_0-1716948669559.png

Please follow these steps:
1.Enter the following data manually.

vzhouwenmsft_1-1716948778800.png

 

vzhouwenmsft_2-1716948792422.png

2.Use the following DAX expression to create a measure('sumValue' and 'target' correspond to your ' [%_Pop]' and '[%_Target]' respectively)

Measure = 
VAR _a = SELECTEDVALUE('Table (2)'[Column1])
RETURN 
SWITCH(TRUE(),
_a = "red",IF([sumValue] <= [target] ,[sumValue],BLANK()),
_a = "green",IF([sumValue] > [target] , [sumValue] , BLANK()),
[sumValue])

3.Final output

vzhouwenmsft_3-1716948950561.png

vzhouwenmsft_4-1716948966809.png

 

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

Dear Colleagues!

I'd like to thank you for your contribution to my request above.
All your different solutions worked perfectly.
Thank you again.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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