Forum Discussion

robertosangi's avatar
robertosangi
Helper I
4 years ago
Solved

Conditional formatting column and reorder

Hi,

 

I have a question regarding modeling a table that follows:

 


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

  • 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

     

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

     

     

    Then create the measure and apply it to background color.

     

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

     

    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.

2 Replies

  • 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

  • v-kkf-msft's avatar
    v-kkf-msft
    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

     

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

     

     

    Then create the measure and apply it to background color.

     

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

     

    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.