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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
AuburnEagle2315
Advocate I
Advocate I

Conditional Formatting Based on Measure

I have a column(Act/TGT) that divides current revenue with its target to get a percentage.

 

I want to apply conditional formatting to highlight values that are below the elapsed shipment days.

 

For example,  today is 16th of 21 days available for shipping.  So 16/21 = 76% 

 

So all values in Act/TGT column that is below the above calculated value should have conditional formatting applied. The above value changes everyday. 

 

I have a measure to calculate the number of elapsed shipment days.

 

If my understanding is correct, below formatting should give me what I want.

 

Minimum value 0 and Max value being the highest value. The field only returns one value: 76%.

 

So the range should be 0 ~ 76

 

However, this highlights all the values, above & below 76, to red.

 

What am I doing wrong?

 

I'd really appreciate your advice on how to solve this issue.  

AuburnEagle2315_1-1650927230165.png

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

For this I would use some variation of the following and select this measure using a Field Value in the conditional formatting options. 

ColorDays = IF [ActTGT%] > SELECTEDVALUE ShippingTargets[Target] ), "#1b7640", "#ff0000" )

The selected value function allows this to be dynamic by referencing a small table of shipping targets you would need to build. If you just want the color to change at a certain static number, you could remove that piece. 

View solution in original post

4 REPLIES 4
Syndicate_Admin
Administrator
Administrator

Hello... I have a difficulty, I need to apply conditional formatting according to a series of criteria and these criteria are different according to classification (general or special)

darandas1_0-1668803815059.png

I have only been able to apply conditional formatting of the general by the common command, but since this is changing, I know that it must be with a measure of if or I do not know ...

Help please

mahenkj2
Solution Sage
Solution Sage

because, you are using Format by 'Color scale' and then keeping same color for Minimum and Maximum. This will make same red color for all the values, if you use two different color for Min and Max, then it will format a color gradient for all the values. 

 

Perhaps, in the format by, you should use 'Rules' category if you just want one kind of color for values matching the conditions and no format/different format for not matching the condition.

If I use the rule category, there doesnt seem to be a way to have max to change based on number of elapsed days.

 

I need the range to be from 0 to (number of elapsed day/total number of shipment days)

 

There isnt an area to add in a field.

Anonymous
Not applicable

For this I would use some variation of the following and select this measure using a Field Value in the conditional formatting options. 

ColorDays = IF [ActTGT%] > SELECTEDVALUE ShippingTargets[Target] ), "#1b7640", "#ff0000" )

The selected value function allows this to be dynamic by referencing a small table of shipping targets you would need to build. If you just want the color to change at a certain static number, you could remove that piece. 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.