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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
GVallentgoed
Helper II
Helper II

Conditional Formatting Calculation Error When Using Percentages

Having a problem conditionally formatting my pie graph to be a specific color based on a percetnage range.  In the example provided, a score of >=90% and <95% should produce a yellow result. A score of <90% should product an orange result.  In this example, a score of 90.1% is producing an incorrect orange result.  The issue here is taking an average of all on-time percentages for each month will not produce the same result vs using the raw values.  In this example, using the on-time percentages for each month rather than the raw values is producing an incorrect OTP of 88.9% causing the orange color.   I'm stumped. It's not a basic percision problem, so rounding doesn't help. I can't reference the raw values because they are always changing. As far as I can tell, there's no functionality to make it reference the secondary percent data in brackets.  The only way is to convert my on-time values into percents, but this produces incorrect results due to averaging the percentages.   conditonal format OTD.pngTable Data.png

1 ACCEPTED SOLUTION

Issue is resolved. I was making it more complicated than it was. I used the Matrix graph as a pivot chart. Created new measure to calculate on-time percetnage and then link conditoinal format to matrix pivot.  Super Simple. I feel dumb. >.< Thanks though!success.png

View solution in original post

9 REPLIES 9
MFelix
Super User
Super User

Hi @GVallentgoed ,

 

For this you need to use a new metric that calculate those values something similar to this:

 

Colouring = DIVIDE(SUM('Table'[Value]), CALCULATE(SUM('Table'[Value]), ALLSELECTED('Table'[Attribute])))

 

I'm assuming that your On-time / Late is a column on your data and not the value for each column.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



The issue I'm having with this solution is its creating a separate "total" category that only applies to the total table value.  This is adding additonal values to the data when not selected for "total".  It also breaks if I want to select specific dates in the table.  For example, If I want the on-time percentage for 1 individual SCAC for the 1st quarter of the year (jan, feb, march)  I now need a new total to reference just for those months.  The one you provided is referencing the entire table and not just the 1st quarter. 

Hi @GVallentgoed ,

 

Not sure if I understand what you mean by need a new total reference just for those months. The metric I used is based on the ALLSELECTED meaning that only considers the selected period, individuals and so on.

 

Your data was presented in a single table, are you using dimension tables? Can you explain a little bit better the error you are having implementing this solution.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Should the formula you provided be inputted into my excel source data or directly into PBI?

The calculation must be placed in Power bi


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



On-Time and Late are are separate columns with their own values. Each value is the sum of the On-time and Late for that SCAC in that month.  Should the On-Time and Late be combined into a single column?  Currently, when I run the formula you provided in both scenerios I get an error ssaying "Too many arguments passed to the SUM function". Single Column OTD.pngTable Data.pngfunction error.png

Hi @GVallentgoed ,

 

There are two questions on this, the first part has you refer your need to make the unpivot of the On-Time and Late into a single column this can be achieve on power query.

 

The second part is the error on the measure you have the parentheses on the incorrect place and you are no closing the sum.

 

Do you know how to do the unpivot or do you need some example in PBIX format?


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Issue is resolved. I was making it more complicated than it was. I used the Matrix graph as a pivot chart. Created new measure to calculate on-time percetnage and then link conditoinal format to matrix pivot.  Super Simple. I feel dumb. >.< Thanks though!success.png

when I use unpivot function to put into single column and then apply formula, this is the new result. I don't understand. unpivot table.png

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors