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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
robertosangi
Helper I
Helper I

Conditional formatting column and reorder

Hi,

 

I have a question regarding modeling a table that follows:

robertosangi_1-1647439804170.png

 


first of all I want to color column 1  as red and column 2 as yellow.

 

Secondly I want to order them as per picture. 
I tried as shown here: https://community.powerbi.com/t5/Desktop/Matrix-Column-Head-Order/td-p/71572

But didn't work

 

Any possibilities? 
Thanks

1 ACCEPTED SOLUTION
v-kkf-msft
Community Support
Community Support

Hi @robertosangi ,

 

Please add the Index column in Power Query Editor:

 

Index = if [Sintesi Stato] = "non caratterizzato" then 1 else if [Sintesi Stato] = "in Progettazione" then 2 else if [Sintesi Stato] = "in autorizzazione" then 3 else 4

vkkfmsft_0-1647850442279.png

vkkfmsft_1-1647850484247.png

 

Then sort [Sintesi Stato] column by [Index] field.

 

vkkfmsft_2-1647850549020.png

 

Then create the measure and apply it to background color.

 

Measure = 
SWITCH ( MAX ( 'Table'[Index] ), 1, "red", 2, "yellow" )

vkkfmsft_3-1647851074257.pngvkkfmsft_4-1647851120619.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
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
v-kkf-msft
Community Support
Community Support

Hi @robertosangi ,

 

Please add the Index column in Power Query Editor:

 

Index = if [Sintesi Stato] = "non caratterizzato" then 1 else if [Sintesi Stato] = "in Progettazione" then 2 else if [Sintesi Stato] = "in autorizzazione" then 3 else 4

vkkfmsft_0-1647850442279.png

vkkfmsft_1-1647850484247.png

 

Then sort [Sintesi Stato] column by [Index] field.

 

vkkfmsft_2-1647850549020.png

 

Then create the measure and apply it to background color.

 

Measure = 
SWITCH ( MAX ( 'Table'[Index] ), 1, "red", 2, "yellow" )

vkkfmsft_3-1647851074257.pngvkkfmsft_4-1647851120619.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
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

@robertosangi The column part of the pivot we can not use conditional formatting

 

for values you can have

Switch(True() ,

Max(Table[Sintesto Stato]) , "Value of 2", "Yellow",

Max(Table[Sintesto Stato]) , "Value of 1", "Red",

//Add other

)

 

You can use this in conditional formatting using field value option

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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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