Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Conditional formatting by row

Hello Everyone,

 

I have a data set showing in a matrix. The rows indicate the KRI and then I have the Quarters as columns.

I would like to do conditional formating on the visualization that can be different for each row. I  could only manage to have the conditional formating be based on a specific value.

 

To better understand the data, I have a column for Key Risk Indicators and another column for its value. The values are entered manually each month by the user after selecting the right date.

 

 

 

 

Thank You

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

     

    Agree with VijayP  that you need to create a measure for multiple conditions.

     

    Below is my example:

    Conditional Formatting = 
    SWITCH(TRUE(), 
    CONTAINSSTRING(MAX('Table'[KRI]),"Budgeted Gross Margin"), IF(SUM('Table'[Value])>12,"Light Green","Red"),
    CONTAINSSTRING(MAX('Table'[KRI]),"Days Inventory"), IF(SUM('Table'[Value])<=35,"Red", IF(SUM('Table'[Value])<=45,"Yellow","Green")), 
    "Light Blue")

    Output:

     

    Best Regards,
    Eyelyn Qin
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

4 Replies

  • VijayP's avatar
    VijayP
    Community Champion

    Anonymous 

    Create a measure for conditional formatting and use the field value option to create conditional formatting

    I think you are currently using the UI conditional formatting which is not dynamic

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    Agree with VijayP  that you need to create a measure for multiple conditions.

     

    Below is my example:

    Conditional Formatting = 
    SWITCH(TRUE(), 
    CONTAINSSTRING(MAX('Table'[KRI]),"Budgeted Gross Margin"), IF(SUM('Table'[Value])>12,"Light Green","Red"),
    CONTAINSSTRING(MAX('Table'[KRI]),"Days Inventory"), IF(SUM('Table'[Value])<=35,"Red", IF(SUM('Table'[Value])<=45,"Yellow","Green")), 
    "Light Blue")

    Output:

     

    Best Regards,
    Eyelyn Qin
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hello Anonymous 

      Thank you for the reply it helped a lot.

      However, When I tried to do the conditional formating I ran into the following issue.

      In the measure for Budgeted Gross Margin - Packaging i have set the rule for if the value is less than 5 then it should be red. but it is still showing as yellow in the Visualization.

       

      Thank You

      • Anonymous's avatar
        Anonymous
        Not applicable

        So I fixed this.

        All I had to do was replace sum with averge, since in my case I am taking the average of all the values for each quarter.