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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.