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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Rasitha_PB
Frequent Visitor

conditional background formatting to table based on slicer selection

Hi Folks,

Here is the problem..


I want to get below result as of below screenshot using below data model and slicer and table

Rasitha_PB_0-1622031026572.png

Rasitha_PB_1-1622031082226.pngRasitha_PB_2-1622031109940.png


Please note that , Slicer and table is used with same store field from store table.

So I want to get background colour enabled in the table rows based on the slicer value selected in the slicer.

 

I want an idea measure to be used without creating extra tables.

 

Thank you

4 REPLIES 4
v-rzhou-msft
Community Support
Community Support

Hi @Rasitha_PB 

If you build a relationship between Sales and Store table, you couldn't use conditional background formatting successuflly. Due to the relationship and slicer and table is used with same store field from store table, Power BI will make all selected judgment results return true. 

1.png

It is better for you to build an extra unrelated store table. Or you can remove the relationship between Stores and Sales table, then use Sales[Store] in table instead of Store[Store] and build a new measure to calculate the Sum Amount per Stores. Then you can use conditional formatting in table visual successfully.

 

Best Regards,

Rico Zhou

 

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

@Rasitha_PB , to do this you need slicer using an independent slicer table.

 

Then you can have measure like

color =

Switch( True () ,

max(Table[store]) in values(Store[Store]) , "Blue",

"White"

)

 

Then you can use conditional formatting with the field value option and use this measure

 

if needed , check

How to do conditional formatting by measure and apply it on pie?: https://youtu.be/RqBb5eBf_I4

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hi @amitchandak ,

I am trying to find a different way , as I have many visuals in a Dashboard page as some of them are connected to this slicer.

Anonymous
Not applicable

Hi @Rasitha_PB 

 

Please refer to this video,

 

https://www.youtube.com/watch?v=DLq5i1mlFqg&t=277s

 

Thanks

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.