Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
kdanielv
New Member

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

 

kdanielv_0-1711036542760.png

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.

 

kdanielv_2-1711037741653.png

 

 

EDIT: Something like this excel right here:

kdanielv_0-1711046834697.png

 

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

 

Thanks!

1 ACCEPTED SOLUTION

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.

Colour 1.pngColour.png

View solution in original post

7 REPLIES 7
_AAndrade
Super User
Super User

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





Did I answer your question? Mark my post as a solution! Kudos are welcome.

Proud to be a Super User!




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:

kdanielv_0-1711046869445.png

 

 

Now your formula seems right, so if is not working we need take a look the data and data model to underdtand what is wrong.

If you could Share a pbix file I could take a look.

If it's not possible, try to debug your formula putting the formula on the matrix and see what is returning.

For example, create a measure only with MAX( table REAL%) and see what this formula returns on the matrix.

And after do it the same for the other MAX funcion.

This is what I would do.

I hope this can help you to solve your problem.

 





Did I answer your question? Mark my post as a solution! Kudos are welcome.

Proud to be a Super User!




Seems like the MAXX colouring is based on the total, not the Std for each individual row.

 

kdanielv_0-1711051904566.png

 

Let me try to change my data to something generic so I can share a pbix file

Why not use this instead:

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

I tried with your formula and is giving me the same result. Not quite sure what's going on.

 

kdanielv_1-1711052229530.png

 

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.

Colour 1.pngColour.png

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.