cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sathvik123
Helper V
Helper V

Expression.Error: The name 'SWITCH' wasn't recognized. Make sure it's spelled correctly.

Hello All,

 

I am creating a custom column and I am not getting any syntax errors but when I click ok I am getting below error.

Could any one please help how to fix this

 

 

Sathvik123_0-1669432377280.png

 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Switch is a DAX function not an M function?  Write it as a calculated column formula

=if(and([Region="APAC",OR([AgentDepartment]="Hyd",[AgentDepartment]="Unknown")),"ASD Hyd",blank())

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

Switch is a DAX function not an M function?  Write it as a calculated column formula

=if(and([Region="APAC",OR([AgentDepartment]="Hyd",[AgentDepartment]="Unknown")),"ASD Hyd",blank())

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur ,

 

I am getting below error.

 

Sathvik123_0-1669433480445.png

 

Write a calculated column formula in DAX not a Custom formula in M


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur ,

 

Could you please help how to do dax for this.

Here my region is a table created in power bi

Already shared that.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Top Solution Authors