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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
22LACMT
Helper III
Helper III

Switch functions error

Does anyone know why I am getting this error? and how to fix it? 

 

OverallstarRatingNR = SWITCH( ProviderInfo[Overall Rating] = "0", "Not Rated", ProviderInfo[Overall Rating] = "1", "1",ProviderInfo[Overall Rating] = "2", "2",ProviderInfo[Overall Rating] = "3", "3",ProviderInfo[Overall Rating] = "4", "4", ProviderInfo[Overall Rating] = "5", "5")
 

22LACMT_0-1691079973564.png

 

1 ACCEPTED SOLUTION

Hi @22LACMT ,

You are actually adding ProviderInfo[Overall Rating] ="0" in your formula as mentioned above. It should be as below,

SWITCH(ProviderInfo[Overall Rating],"0", "Not Rated","1","1","2","2","3","3","4","4","5","5")

Let me know if you still faces the issue.

Thanks!

 

Inogic Professional Services Division

Power Platform and Microsoft Dynamics 365 CRM Development – All under one roof!

Drop an email at crm@inogic.com

Services:  http://www.inogic.com/services/

Power Platform/Dynamics 365 CRM Tips and Tricks:  http://www.inogic.com/blog/

Inogic Professional Services: Power Platform/Dynamics 365 CRM
An expert technical extension for your techno-functional business needs
Service: https://www.inogic.com/services/
Tips and Tricks: https://www.inogic.com/blog/

View solution in original post

5 REPLIES 5
SamInogic
Solution Sage
Solution Sage

Hi @22LACMT ,

 

You need to use below DAX for switch case within your column,

 

OverallstarRatingNR = SWITCH(ProviderInfo[Overall Rating],0, "Not Rated",1,"1",2,"2",3,"3",4,"4",5,"5")


Please refer to the below screenshot,

 

SamInogic_0-1691152075831.png

 

Thanks!

Inogic Professional Services Division

Power Platform and Microsoft Dynamics 365 CRM Development – All under one roof!

Drop an email at crm@inogic.com

Services:  http://www.inogic.com/services/

Power Platform/Dynamics 365 CRM Tips and Tricks:  http://www.inogic.com/blog/

Inogic Professional Services: Power Platform/Dynamics 365 CRM
An expert technical extension for your techno-functional business needs
Service: https://www.inogic.com/services/
Tips and Tricks: https://www.inogic.com/blog/

Thank you for your help!  I tried the above dax and am experiancing a new error message(below)  do you know where I should be using the value function? 

 

22LACMT_0-1691173647953.png

Error: Dax comparison operaations do not support comparing values of type text with values of type integer. Consider using the VALUE or FORMAT function to convert one of the values. 

 

 

Hi @22LACMT  ,

 

It seems that your “Overall Rating” column is of type text so you can try with below DAX expression,

 

OverallstarRatingNR = SWITCH(ProviderInfo[Overall Rating],"0", "Not Rated","1","1","2","2","3","3","4","4","5","5")

 

Please refer to the below screenshot for the same,

 

SamInogic_0-1691389392976.png

 

Thanks!
 

Inogic Professional Services Division

Power Platform and Microsoft Dynamics 365 CRM Development – All under one roof!

Drop an email at crm@inogic.com

Services:  http://www.inogic.com/services/

Power Platform/Dynamics 365 CRM Tips and Tricks:  http://www.inogic.com/blog/

Inogic Professional Services: Power Platform/Dynamics 365 CRM
An expert technical extension for your techno-functional business needs
Service: https://www.inogic.com/services/
Tips and Tricks: https://www.inogic.com/blog/

Hi, I feel like there is something (maybe on a formatting level) missing.  

 

OverallstarRatingNR = SWITCH( ProviderInfo[Overall Rating] ="0","Not Rated","1","1","2","2","3","3","4","4","5","5")
 
I'm still experiancing the Switch fuction error : "Function switch does not support comparing values of type true/false with values of type text. consider using the Value or FORMAT function to convert on of the values. 

Hi @22LACMT ,

You are actually adding ProviderInfo[Overall Rating] ="0" in your formula as mentioned above. It should be as below,

SWITCH(ProviderInfo[Overall Rating],"0", "Not Rated","1","1","2","2","3","3","4","4","5","5")

Let me know if you still faces the issue.

Thanks!

 

Inogic Professional Services Division

Power Platform and Microsoft Dynamics 365 CRM Development – All under one roof!

Drop an email at crm@inogic.com

Services:  http://www.inogic.com/services/

Power Platform/Dynamics 365 CRM Tips and Tricks:  http://www.inogic.com/blog/

Inogic Professional Services: Power Platform/Dynamics 365 CRM
An expert technical extension for your techno-functional business needs
Service: https://www.inogic.com/services/
Tips and Tricks: https://www.inogic.com/blog/

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Kudoed Authors