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
Louis66
Resolver I
Resolver I

Conditional formatting working partially !!!

Hello, I have a simple problem - I have positive and negative returns for an Index... using Conditional formatting (measure), all my bars are blue, even though I have negative returns (sould be in Red)...

Louis66_0-1672758579092.png

 

Can someone help me ?

 

Louis

1 ACCEPTED SOLUTION

HI @Louis66 ,

 

So in that case you need to modify your measure. Use SUM(Data[Returns]) in your condition in the measure.

You won't need a SELECTEDVALUE there. You can write your measure something like following:

Color =
VAR returns_value = SUM ( Data[Returns] ) // total value of the value used
RETURN
    SWITCH (
        TRUE (),
        returns_value < 0, "#FF0000", // hexcode for Red color
        "#0000FF" // hexcode for Blue color
    )

I just wrote the DAX above on the fly, so check if there are any syntax errors.

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

View solution in original post

3 REPLIES 3
Pragati11
Super User
Super User

HI @Louis66 ,

Few questions:

1. Is Color a measure that you have created?

2. On your visual if you represnting a column value, in your case Data[Returns], then it must have been summarised to SUM, AVERAGE, etc. But in your measure you are using the column value but not the one represented on your visual in my view.

Can you share screenshot around what you are displaying on your visual?

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Hello Pragati, yes this is a measure I created, and yes I did use SUM for my returns... this is the screen shot.

Louis66_0-1672765524055.png

... and my data :

Louis66_1-1672765594045.png

 

It is the first time I have that kind of problem...

 

Louis

HI @Louis66 ,

 

So in that case you need to modify your measure. Use SUM(Data[Returns]) in your condition in the measure.

You won't need a SELECTEDVALUE there. You can write your measure something like following:

Color =
VAR returns_value = SUM ( Data[Returns] ) // total value of the value used
RETURN
    SWITCH (
        TRUE (),
        returns_value < 0, "#FF0000", // hexcode for Red color
        "#0000FF" // hexcode for Blue color
    )

I just wrote the DAX above on the fly, so check if there are any syntax errors.

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.