Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Different Conditional Formatting for Values and Totals on the Same Visual

Hello guys,

I have a matrix table with the row and column subtotal done in Power BI. I want to set a conditional background formatting for my values and total. The issue is that the taget of my values are different from the target of my totals. So, how do I achieve this? 

 

This is a random example of my matrix:

CategoryChina Japan Total
Product xx98.5%98.4%98.4%
Product yy97.3%98.2%97.9%
Total95.4%97.5%96.5%

 

What I want to achieve is the following:

1. If China value is => 98.8%, green else red

2. If Japan value is => 98.6%, green else red

3. If the total (column total) of China => 98.4%. green else red (Please, note that the total is generated in PBI)

4. If the total (column total) of Japan  => 98.4%. green else red (Please, note that the total is generated in PBI)

5. If the total (row total) of Product xx => 98.4%. green else red (Please, note that the total is generated in PBI)

5. If the total (row total) of Product yy => 98.4%. green else red (Please, note that the total is generated in PBI)

 

Please, how do I go about this? Is it possible to apply 2 different conditional formattings to the same visual (one for values and the second for totals)?

6 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hello Padycosmos ,

    Thanks for your response. However, the video only showed how to apply one format to either the values only, totals only or values and total. In my case one format is probably not applicable to both values and totals, as they have diferrent targets.

    • Padycosmos's avatar
      Padycosmos
      Icon for Solution Sage rankSolution Sage

      Please create 2 measures, apply one measure to values only and the other measure to Totals only. 

      A sample measure is shown below:

      Color =
      VAR col = SWITCH(TRUE(),
      CONTAINSSTRING(SELECTEDVALUE(Orders[Category]),"Fur")||CONTAINSSTRING(SELECTEDVALUE(Orders[Category]),"Off"),"Red",CONTAINSSTRING(SELECTEDVALUE(Orders[Category]),"Tech"),"Yellow")
      RETURN
      col

       

       

       

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hey Padycosmos .

    The critical thing I'm finding hard to do at this point is how to apply these two measures (for values and the total) on the same visual. They overwrite one another (i.e. when I apply for value only, it works but when I go back to apply for totals only, the formats of values get removed). I don't if this is because of my limited knowledge in Power BI or that's just the way it is?

  • You can only apply one set of background conditional formatting rules, you can't apply two separate background conditional formatting rules, one for values and one for totals?