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
ajrodr198203
New Member

Background Color based on Slicer Selection

Hello all,

 

I have a requirement to change background color of a shape based on the filtered values from any of the slicers included on the report. The measure I have so far works but it changes the background color of all the shapes instead of the one that is filtered. Also, in the case where a slicer values filters down to two or more statuses, it doesn't highlight anything. See examplese below. I've also included a link to a sample pbix file. 

 

https://drive.google.com/file/d/1GQoOzNfLmfjDFtX7Evn9J3Z9FFuzlYrC/view?usp=drive_link

 

DAX measure for background colore:

DAX.PNG

 

Example 1, when filtered to Company 1 no background color is changed because there is more than one status. The requirement is to only highlight the filtered statuses so there would only be 2 shapes with a blue background.

 

example 1.PNG

 

Example 2, when filtered to Company all backgrounds change. The requirement is to only highlight the filtered status(es) so there would only be 1 shape with a blue background. 

 

example 2.PNG

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @ajrodr198203 ,

 

Thanks for the reply from @danextian , please allow me to provide another insight:

 

You can try formula like below:

11 =
VAR sel_practise =
    SELECTEDVALUE ( 'Table'[Requesting Practice] )
VAR choose =
    SELECTEDVALUE ( 'Table'[Requesting Practice] ) & " "
        & SELECTEDVALUE ( 'Table'[Order Status] )
VAR target_ =
    MAX ( data[Requesting Practice] ) & " "
        & MAX ( data[Order Status] )
VAR count_ =
    COUNTROWS ( FILTER ( data, data[Requesting Practice] = sel_practise ) )
RETURN
    IF ( count_ > 0, "Blue", IF ( choose = target_, "Blue", "Gray" ) )

vkongfanfmsft_0-1713170939001.png

vkongfanfmsft_1-1713170950725.png

Best Regards,
Adamk Kong

 

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

Hi @ajrodr198203 ,

 

Thanks for the reply from @danextian , please allow me to provide another insight:

 

You can try formula like below:

11 =
VAR sel_practise =
    SELECTEDVALUE ( 'Table'[Requesting Practice] )
VAR choose =
    SELECTEDVALUE ( 'Table'[Requesting Practice] ) & " "
        & SELECTEDVALUE ( 'Table'[Order Status] )
VAR target_ =
    MAX ( data[Requesting Practice] ) & " "
        & MAX ( data[Order Status] )
VAR count_ =
    COUNTROWS ( FILTER ( data, data[Requesting Practice] = sel_practise ) )
RETURN
    IF ( count_ > 0, "Blue", IF ( choose = target_, "Blue", "Gray" ) )

vkongfanfmsft_0-1713170939001.png

vkongfanfmsft_1-1713170950725.png

Best Regards,
Adamk Kong

 

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

 

danextian
Super User
Super User

Hi @ajrodr198203 

 

Look into using  ISFILTERED which returns true when the specified table or column is being filtered directly so if a filter is applied to Column A but not Column B, it returns true only for Column A.





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.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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