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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

1 REPLY 1
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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.