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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
tloup
Frequent Visitor

Error with conditional formatting and calculation items combining time intelligence and formatting

Hello 

 

I have a table that I want to be dynamic with time intelligence. I have therefore made a calculation group called time intelligence which allows users to switch between timeframes for all the metrics. I then wanted the format of these metrics to change depending on the timeframe because the numbers get a lot bigger / smaller depending on the timeframe selected. The final piece of formatting I want to show is a certain colour depending on the value of the metrics (i.e. if it is below target then 'red'). 

 

The problem I am facing is when I combine all these things together Power BI gives me an error saying I can't work with my number formatting and colour formatting at the same time. The error message says: 'Cannot convert value 'Red' of type Text to type Numeric'

The DAX code for my number formatting is the following:

IF ( OR ( CONTAINSSTRING ( SELECTEDMEASURENAME (), "*%*" ), CONTAINSSTRING ( SELECTEDMEASURENAME (), "CR*" ) ), FORMAT ( SELECTEDMEASURE (), "0%" ), FORMAT ( SELECTEDMEASURE () / 1000, "£#,0K" ) )


The DAX code for my conditional formatting is the following (I would like to change this to be dynamic using something like SELECTEDMEASURE () instead of selecting the individual measure but this doesn't seem to work) :

IF([Demand Sales vs BGT] < 0, "Red", BLANK())


Any help would be v gratefully received! 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@tloup Can't seem to replicate this. Is the dynamic format for the measure [Demand Sales vs BGT]? Only thing I don't have is the calculation group involved. Any chance you can share a PBIX?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
seemakunnath
Regular Visitor

Did the above get resolved? I am trying to do something similar to format certain timeintelligence values of all SELECTEDMEASURE to have colours based on their values. 

 

Screenshot 2024-09-09 105001.pngScreenshot 2024-09-09 105025.png

 

Is there a solution to this please?

Greg_Deckler
Super User
Super User

@tloup Can't seem to replicate this. Is the dynamic format for the measure [Demand Sales vs BGT]? Only thing I don't have is the calculation group involved. Any chance you can share a PBIX?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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