Forum Discussion

kdanielv's avatar
kdanielv
New Member
2 years ago
Solved

Conditional formatting a percentage based on other column

Hi forum,

 

I've been trying to do some color formatting on a matrix. I have a Std and Real values on columns like this

 

What I'm looking for is to color format the column 'Real' based on 'Std' value.

 

I've tried creating a measure

 

Color = IF ( MAX ( 'Table'[REAL_%]) < MAX ('Table'[STD_%]), "Green", "Red")

 

The thing is that is coloring Red even values that are lower than "Std" which is supposed to be green.

 

 

 

EDIT: Something like this excel right here:

 

Any comments on this? What I'm I doing wrong?

 

Thanks!

  • I think if you could provide a sample of your data set would be helpful.

    Especially since I can't see how you could have two columns with the same name in Power BI.

    Later edit: Try to create two separate measures, 1 for Real% January and one for Real% February. Maybe it will work.

7 Replies

  • _AAndrade's avatar
    _AAndrade
    Icon for Resident Rockstar rankResident Rockstar

    Hi,

    Probably I'm not getting your idea, but in your formula you only returns Green color if the Real_% is bigger than "Std".
    So 1.32% is lesse than 1.67% so returns red and the same for the next par of values.
    Probably i'm missing something

    • kdanielv's avatar
      kdanielv
      New Member

      My bad, I used the wrong symbol and just edited my post. 

       

      Either way, I think that what I'm saying on the formula is: 

      Color = IF ( MAX ( 'Table'[REAL_%]) < MAX ('Table'[STD_%]), "Green""Red")

       

      If the maximum value in the column 'Real_%' is less than the maximum value in the column 'Std_%', then the condition is true and it returns a Green color, otherwise, Red.

       

      Something like this excel that I have here:

       

       

      • FromZero2BIHero's avatar
        FromZero2BIHero
        Frequent Visitor

        Why not use this instead:

        Colour =
         
        SWITCH(
            TRUE(),
            MAX('Table'[REAL_%])<MAX('Table'[STD_%), "GREEN",
            "RED")