Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

Conditional formatting per rows in a matrix

Dear Community,
I want to color rows of matrix,
As you can see in the pics, I have a matrix with rows C and S, How do I conditional formatting each row in the matrix? ( The issue is that I do not want "S" be a value in matrix, Otherwise if it was value I simply make it colorful by conditional formatting)


Thanks in advance

6 Replies

  • Anonymous , in case C and S are rows. C will only come as sub total.

    Not very clear on need , You can create a color measure

    like

    if(isinscope(Table[C]), "green", "white")

    and you can use them in conditional formatting (for each value) using "Field value" option

     

    Other way


    Measure =
    Switch(true(),
    max(Table[Column]) = "R1" , "Red" ,
    max(Table[Column]) = "R2" , "Green" ,
    max(Table[Column]) = "R3" , "Pink "
    )

    Measure =
    Switch(true(),
    max(Table[status]) = "In production" , "Red" ,
    max(Table[status]) = " Product completed" , "Green" ,
    "blue "
    )

     

    How to color

    https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-numbers-in-the-column
    https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values

     

    isinscope

    https://www.kasperonbi.com/use-isinscope-to-get-the-right-hierarchy-level-in-dax/

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks amitchandak 

      Could you please explain more, I should add that I have measure, which called ROL, based on the result of that measure which produces -1,0,1  I need to color each row, If ROL=1, row should be green, etc, 
      is this possible in power BI ? 

      • amitchandak's avatar
        amitchandak
        Super User

        Anonymous , You can return color when Based on the value of measure or gorup by.  and the use this new measure in conditional formatting. There if you choose field value. you can give color measure. Give this for all values of matrix . There is no row color in power bi

         

        This video is for card. But option is true for matrix

        https://youtu.be/veCtfP8IhbI

  • Anonymous's avatar
    Anonymous
    Not applicable

    Anonymous 
    You can create a flag measure with IF() or Switch() on S to give each category a value, then use the measure to value in the conditional format: 

     

    Something like: 

    Measure (s) =Switch(True(),
    [S] = "xxx", 0,
    [S] = "xxxx",1,

    ...))

     


    Paul Zheng _ Community Support Team
    If this post helps, please Accept it as the solution to help the other members find it more quickly.