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
lesg
Frequent Visitor

Conditional Formatting based on column value

Hi Guys,

 

I have a column showing current stock and a column showing required stock holding.

 

If the required stock holding is >= current stock, I want that to be coloured in Green

If the required stocking holding is < current stock, I want this to be red

 

When I try to do this in the conditional formatting by selecting 'Field value', whilst I can select the field (cover) it does not show and gives me no further options to complete this condition?

 

lesg_0-1673371094032.png

 

Is this a bug or is there a different way to set this value

 

 

9 REPLIES 9
Anonymous
Not applicable

Hi @lesg 

Your measure may have some issues so that you cannot choose the measure, you can try the following measure:

Measure = if(SUM('Table'[Required Cover])>=SUM('Table'[on Hand]),"Green","Red")

vxinruzhumsft_0-1673424412077.png

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you!

Hi,

Thanks for that suggestion, however, when I try and add, I get an error:

 

lesg_0-1673443149170.png

 

The cover is a measure created work out how much stock should be required and not an actual column in the table?

Anonymous
Not applicable

Hi @lesg 

You can try the following code :

Measure = if([Cover]>=SUM('Table'[on Hand]),"Green","Red")

and you need to put the measure to the conditional formatting:

vxinruzhumsft_0-1673505494906.png

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hi Yolo,

 

I dont understand what you mean, How can I add the function to the conditional formatting, there is no option to add a measure? as as per my original post, the measure I created, shows in dropdown, but does not show as an option when selected in the dropdown:

 

lesg_0-1673611738739.png

 

Anonymous
Not applicable

Hi @lesg 

The measure you have created is a calculated measure, you cannot put it to the conditional formatting, you need to create a measure like the measure I have offered, then you can put it to the conditional formatting, the measure I have created is give the condition to change the color. you can refer to the attachments I supplied above.

and you can refer to the following link:

Conditional Formatting Using Custom Measure - Microsoft Power BI Community

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Padycosmos
Solution Sage
Solution Sage

Padycosmos_0-1673381185152.png

Here you can see that the Sales column has been conditionally formatted based on the  values in the Profit Column. Hope this helps

Hi Thanks for that, but does not seem to help im my situation, any numbers I add I dont get any different results.

I assume I use the maximum number? I tried 500 up to your example, 20000:

 

lesg_0-1673389307418.png

 

 

Yes, you can change Percentage to Number in the Rules dropdown. Also type >= Max in the second rule on the right hand side condition

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.