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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Conditional formatting based on attribute

I have unpivoted columns on attribute- CY, Budget and SPLY , how do I enter conditional formatting for specific PM%

 

example to calculate Product Margin% for CY ,if I select CY, then CY PM% -Budget PM% will be green or else if low then red,

 

similarly if i select SPLY, then it should be compared to CY, CY GP% -LY GP% the measure should say if greater then green or else red

 

the problem now is if i put a formula it applies to all PM% including budget, i only want it for CY and SPLY

 

Amri25_0-1605620375890.png

 

3 REPLIES 3
Anonymous
Not applicable

I tried it, it works but the issue coming is maybe this formula i put in for product margin, it selects whatever selected as filter. I put the same for Net sales.
P&L Budget PM = CALCULATE(SUM(Append1[Product Margin]),FILTER(Append1,Append1[Attribute] = SELECTEDVALUE(Append1[Attribute])))
 
I want the end result to be if I select current year(in attribute current year) ,it should be CY%>bgt PM% else CY%>LY% for attribute SPLY
 

 

Anonymous
Not applicable

Screenshot here: I selected Current Year and Budget together. 

 

Amri25_5-1605635512477.png

 

amitchandak
Super User
Super User

@Anonymous , create a color measure and use that conditional formatting with field values

Color = if([CY PM% ]> [Budget PM] ,"green","red")

 

refer: https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-numbers-in-the-column
https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.