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

Column colors based on header, not on content

Dear all,

 

I am working with school data on sanitation and cleanliness and we are now starting to use PowerBi to analyze and present the data. We have a matrix in PwerBI based on a column with 5 values:

NP, no star, 1 star, 2 stars, 3 stars.

 

For each of these values, I present the number of schools that comply to this condition and the row percentage. The table looks like this: 

matrix examplematrix example

What I would like to, but can not find is to give background colors on the columns, based on their header and not on the values inside the matrix. So for NP I would like to the two colums (# schools and % schools), to be colored grey, for no stars, red, 1 star yellow etc ..

Anyone has some suggestions on how to do this?

 

Thanks

 

1 ACCEPTED SOLUTION
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

You can create a measure like below and later use it for conditional formatting in your Matrix Visual.

conditional formating = 
VAR _sv = SELECTEDVALUE( 'Table'[Category] )
RETURN 
SWITCH(
    TRUE(),
    _sv = "NP", 1,
    _sv = "no star", 2,
    _sv = "1 star", 3
)

This is how you set up Conditional Formating on Value fields in your Matrix.

image.png

 
Please see the attached file for reference.
Hope this helps!
 
Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski

 

View solution in original post

2 REPLIES 2
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

You can create a measure like below and later use it for conditional formatting in your Matrix Visual.

conditional formating = 
VAR _sv = SELECTEDVALUE( 'Table'[Category] )
RETURN 
SWITCH(
    TRUE(),
    _sv = "NP", 1,
    _sv = "no star", 2,
    _sv = "1 star", 3
)

This is how you set up Conditional Formating on Value fields in your Matrix.

image.png

 
Please see the attached file for reference.
Hope this helps!
 
Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski

 

Anonymous
Not applicable

Dear Mariusz,

 

just what the doctor ordered! Works like a charm,  

 

Thanks ...

 

Ubo

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