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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

DAX IF Statement not working anymore

Hi!

 

It's the strangest thing. I'm trying to calculate NPS score and have used this IF statment for classifying the values between 0 - 10.

 

Classses = IF([NPS]<=6, "Detractors", IF([NPS]<=8,"Neutrals","Promoters"))
 
This syntax has worked for me before but now when I open the report it gives me an error:
 
"The syntax for '"Detractors"' is incorrect. (DAX(IF([NPS]<=6. "Detractors", IF([NPS]<=8."Neutrals","Promoters"))))."
 
Can anyone please help me with this?
1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

Hey,

 

I guess this is due to some "quirkiness", please try to rewrite this line

 

Classses = IF([NPS]<=6, "Detractors", IF([NPS]<=8,"Neutrals","Promoters"))

like so

 

Classses = IF([NPS]<=6 , "Detractors", IF([NPS]<=8 ,"Neutrals","Promoters"))

There is just this difference, I added a space between the numbers and the comma.

There seem to be circumstances / combinations that will lead to a replacement of a comme to a point, as the parser treats the comma as a decimal separator. 

Regards,
Tom

 

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

3 REPLIES 3
TomMartens
Super User
Super User

Hey,

 

I guess this is due to some "quirkiness", please try to rewrite this line

 

Classses = IF([NPS]<=6, "Detractors", IF([NPS]<=8,"Neutrals","Promoters"))

like so

 

Classses = IF([NPS]<=6 , "Detractors", IF([NPS]<=8 ,"Neutrals","Promoters"))

There is just this difference, I added a space between the numbers and the comma.

There seem to be circumstances / combinations that will lead to a replacement of a comme to a point, as the parser treats the comma as a decimal separator. 

Regards,
Tom

 

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
Vikram123
Helper I
Helper I

Please Find your NPS Column TYPE is whole number or not 

Anonymous
Not applicable

It is a whole number.

 

Seems that this has something to do with localization settings. As you saw, I had the formula with commas ",". However, when my collegue downloaded the report from powerbi.com, the formula worked and was written in semicolon ";". I still can't get the formula to work with comma nor semicolon. When I download the report from powerbi.com it seems that the language is in Finnish so the syntax should be written with semicolons. However when I look at the formula it is written with commas and gives me the error. My collegue didn't have the error message and everything was working ok.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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