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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
VagelisVlachos
Frequent Visitor

Change color for bar chart into the measure not in conditional formating

Hello.

 

I have this measure that shows in one bar chart the top10 and bottom 10 of customers by profit.

I want to change the color in the measure for a bar chart when its >0 to green and when its <0 to red.From the conditional formating it goes wrong cause the top 2 is green and all the other are going red.

 

Please help!

 

 

Top/Bottom =
VAR top10 =
    RANKX ( ALL ( DimCustomer[Name] ), [Gross Profit],, ASC )
VAR bot10 =
    RANKX ( ALL ( DimCustomer[Name] ), [Gross Profit],, DESC )
RETURN
    IF ( top10 <= 10 || bot10 <= 10, [Gross Profit], BLANK () )
1 ACCEPTED SOLUTION

Change Qty Color =
VAR PDDate =
     ( [Gross Profit])
RETURN
    IF ( PDDate < 0, "#861B14","#499277")
 
You make this a measure and after you make a conditional formating into "bars" and you pick this in the "What field should we base this on"

View solution in original post

3 REPLIES 3
FreemanZ
Super User
Super User

hi @VagelisVlachos 

RANKX relies on filter context. How does you visual look like?

Χωρίς τίτλοas.png

Change Qty Color =
VAR PDDate =
     ( [Gross Profit])
RETURN
    IF ( PDDate < 0, "#861B14","#499277")
 
You make this a measure and after you make a conditional formating into "bars" and you pick this in the "What field should we base this on"

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

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.