The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
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.
Solved! Go to 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:
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.
Hope this helps.
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:
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.
If the product team is reading this, please can you give some feedback.
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!
Proud to be a Super User!