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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! 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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.