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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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

 

 

8 REPLIES 8
v-xinruzhu-msft
Community Support
Community Support

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.

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?

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

 

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.