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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
HamidBee
Power Participant
Power Participant

How do I get these data colours to change based on a DAX measure?

I have the following DAX:

 

CF =
SWITCH ( TRUE, [T Value] >= 0, "Green", [T Value] <= 0, "Red" )

 


I'd like the data label to be green if it is greater than 0 and red if it is less than 0. Unfortunately it does not seem to work.

1 ACCEPTED SOLUTION

I've finally figured out how to do it and it's done using the same DAX measure I had above:

CF =
SWITCH ( TRUE, [T Value] >= 0, "Green", [T Value] <= 0, "Red" )


But it would only work if the report was created using the August version of Power BI. It seems that it's a new feature. It will not work on any older versions of Power BI. If you have the August version of Power BI you should see the measure work as expected. Please see the image below:

 

HamidBee_0-1662540311656.png

 

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi,
this does not seem to be supported according to this thread: https://community.powerbi.com/t5/Desktop/Line-Chart-Conditional-Formatting/m-p/375161
I tried some work-arounds with your dataset without any luck.

Hi @HamidBee,

 

Not sure if you want to use your measure only, but here is a way to get the conditional formatting on the data labels.

 

You can specify the rules as in the following screenshot and get the result.

Screenshot (400).pngScreenshot (401).png

Hope this helps.

 

Thank you,

Vishesh Jain

Did I answer your question?
If yes, then please mark my post as a solution!

Thank you,
Vishesh Jain

Proud to be a Super User!



I've finally figured out how to do it and it's done using the same DAX measure I had above:

CF =
SWITCH ( TRUE, [T Value] >= 0, "Green", [T Value] <= 0, "Red" )


But it would only work if the report was created using the August version of Power BI. It seems that it's a new feature. It will not work on any older versions of Power BI. If you have the August version of Power BI you should see the measure work as expected. Please see the image below:

 

HamidBee_0-1662540311656.png

 

Hi @HamidBee,

 

So here is a weird thing.

 

I opened your current file and the conditional formatting works as it should.

When I open the previous file and try to apply the conditional formatting based on the CF measure you created, it is giving me an error even though I have the Aug 2022 version.

 

Screenshot (404).png

If the product team is reading this, please can you give some feedback.

 

Thank you,

Vishesh Jain

Did I answer your question?
If yes, then please mark my post as a solution!

Thank you,
Vishesh Jain

Proud to be a Super User!



Yes this problem happened to me also. The reason being is that the first file I shared (CF.pbix) was initially created using the June version. Even if it were opened in an August version and then saved it still wouldnt work. The report has to be created using an August version of Power BI from start to end. 

I remember something like this in the PBI monthly update video, but I was not aware that the report has to be created from scratch.

I thought if you just removed the conditional formatting in the old file and added it back again, it would work.

 

This is quite odd!

Did I answer your question?
If yes, then please mark my post as a solution!

Thank you,
Vishesh Jain

Proud to be a Super User!



Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Kudoed Authors