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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

How to change conditionnal formating setting with a slicer ?

Hi, 

 

There are many topics about conditionnal formating but I didn't found what I was looking for. Maybe you can help me. 

 

I have a matrice representing % (issued from a measure) through time.

I have a slicer which allow the user to display the % category he want to check.

 

sebastienke_0-1613997399733.png

 

Each category of this slicer has a target max identified.

sebastienke_2-1613997777333.png

 

I would like to have in my matrice green background when % is under the target and red when it is over.

 

Thank you for your help.

 

 

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Anonymous ,

 

In this case you need to use a measure similar to this one:

 

Formatting =
SWITCH (
    TRUE (),
    SUM ( 'Table'[Value] ) >= MAX ( Target[Target_Max] )
        && SELECTEDVALUE ( 'Table'[Cat] ) IN VALUES ( Target[Cat] ), "Green",
    SUM ( 'Table'[Value] ) <= MIN ( Target[Target_Max] )
        && SELECTEDVALUE ( 'Table'[Cat] ) IN VALUES ( Target[Cat] ), "Red"
)

 

In this case I have used everything on the same table:

MFelix_0-1614000001838.png

But it will work properly if you use a slicer. 

 

Looking at the information you are providing I believe ytou need to use the same measure that you use for changing the calculation based on your target but add the MAX / MIN target value part.

 

If you are not abble to convert the measure to what you need can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.

If the information is sensitive please share it trough private message.


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

4 REPLIES 4
MFelix
Super User
Super User

Hi @Anonymous ,

 

In this case you need to use a measure similar to this one:

 

Formatting =
SWITCH (
    TRUE (),
    SUM ( 'Table'[Value] ) >= MAX ( Target[Target_Max] )
        && SELECTEDVALUE ( 'Table'[Cat] ) IN VALUES ( Target[Cat] ), "Green",
    SUM ( 'Table'[Value] ) <= MIN ( Target[Target_Max] )
        && SELECTEDVALUE ( 'Table'[Cat] ) IN VALUES ( Target[Cat] ), "Red"
)

 

In this case I have used everything on the same table:

MFelix_0-1614000001838.png

But it will work properly if you use a slicer. 

 

Looking at the information you are providing I believe ytou need to use the same measure that you use for changing the calculation based on your target but add the MAX / MIN target value part.

 

If you are not abble to convert the measure to what you need can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.

If the information is sensitive please share it trough private message.


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

Actually the problem was not the measure Formatting (even if SWITCH is actually a better solution than mine), but how to use it in the conditionnal formatting parameters. Thanks to your example file, i was able to do what i wanted to !

 

Thanks @MFelix    

negi007
Community Champion
Community Champion

@Anonymous What i understand from above that you wish to have conditional formating basis the slicer selection. You want to these 4 slicers value to change the conditional formating. However, looking at your Target Min and Target Max it has comma seperated values. Please tell me how will you have conditional formatting for such values. If possible please share your powerbi sample file with more details.




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



Proud to be a Super User!


Follow me on linkedin

Anonymous
Not applicable

coma is my decimal separator. So 0,05 means 5%.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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