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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

DAX comparison operations do not support comparing values of type True/False with values of type Num

Hi, 

 

I'm trying to create a colum that will give me a RAG rating based on the planned and BAU figures. I have created a new column and done the following formula however it gives me the message above. 

 

RAG Rating = if(('Targets and Tolerances'[PLANNED]>'Targets and Tolerances'[BAU]) &&('Targets and Tolerances'[ACTUAL]>'Targets and Tolerances'[PLANNED]),"green",if(('Targets and Tolerances'[PLANNED]>'Targets and Tolerances'[BAU]) &&('Targets and Tolerances'[BAU]<'Targets and Tolerances'[ACTUAL]<'Targets and Tolerances'[PLANNED]),"amber",if(('Targets and Tolerances'[PLANNED]>'Targets and Tolerances'[BAU]) && ('Targets and Tolerances'[ACTUAL]<'Targets and Tolerances'[BAU]),"red",if(('Targets and Tolerances'[PLANNED]<'Targets and Tolerances'[BAU]) && ('Targets and Tolerances'[ACTUAL]<'Targets and Tolerances'[PLANNED]),"green",if(('Targets and Tolerances'[PLANNED]<'Targets and Tolerances'[BAU]) && ('Targets and Tolerances'[BAU]>'Targets and Tolerances'[ACTUAL]>'Targets and Tolerances'[PLANNED]),"amber",if(('Targets and Tolerances'[PLANNED]<'Targets and Tolerances'[BAU]) && ('Targets and Tolerances'[ACTUAL]>'Targets and Tolerances'[BAU]),"red","ERROR"))))))

 

joshuap_0-1600334967801.png

 

I have checked the data type of all columns and they are all decimal number so don't think it is that. Any help is much appreciated.

 

Josh

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , Is this a measure column. Seem like a column. unless [PLANNED], [BAU] etc are measures

 

Looking at code I do not see the error.  Better you use Switch True

Switch( True(),

//Condition , //result,

//Condition , //result,

//else

)

 

To find this error, you have check each condition separately

Anonymous
Not applicable

Hi, thanks for the reply, not entirely sure what you mean though.

 

I have tried the formula with one if and it works but as soon as I add a second if then it comes up with the error message. 

 

These are all columns and it is a column that i created.

 

Thanks

@Anonymous , Can you share a sample pbix after removing sensitive data.

Or check if condition one by for error.

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

Top Solution Authors