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
Sharma0815
Helper II
Helper II

Using SWITCH function to change the values of column to new values and getting this below error,

SWITCH(Table1[Queue],"CSC EZTech" || "CSC ", Programming Support","Engine","Duty","I6Engine","Medium","Other")
 
I have blanks in Queue column,I'm not sure if blank values causing this error.
 
Error:
Function 'SWITCH' does not support comparing values of type Text with values of type True/False. Consider using the VALUE or FORMAT function to convert one of the values.
1 ACCEPTED SOLUTION

OK, let's figure out what is going on here, try this:

 

SWITCH(TRUE(),
  Table1[Queue] = "CSC EZTech" || Table1[Queue] = "CSC ", "Programming Support",
  Table1[Queue] = "Engine","Duty",
  Table1[Queue] = "I6Engine","Medium",
  "Other"
)

@ 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

6 REPLIES 6
Greg_Deckler
Super User
Super User

Maybe try:

 

SWITCH(Table1[Queue] & "","CSC EZTech" || "CSC ", Programming Support","Engine","Duty","I6Engine","Medium","Other")


@ 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...

Thanks @Greg_Deckler ,Tried and  still getting the same error 

SWITCH(Table1[Queue] & "","CSC EZTech" || "CSC ", Programming Support","Engine","Duty","I6Engine","Medium","Other")

 

Function 'SWITCH' does not support comparing values of type Text with values of type True/False. Consider using the VALUE or FORMAT function to convert one of the values.

OK, let's figure out what is going on here, try this:

 

SWITCH(TRUE(),
  Table1[Queue] = "CSC EZTech" || Table1[Queue] = "CSC ", "Programming Support",
  Table1[Queue] = "Engine","Duty",
  Table1[Queue] = "I6Engine","Medium",
  "Other"
)

@ 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...

This one worked for me ,Thanks alot @Greg_Deckler 

 

SWITCH(TRUE(), Table1[Queue] = "CSC EZTech" || Table1[Queue] = "CSC ", "Programming Support", Table1[Queue] = "Engine","Duty", Table1[Queue] = "I6Engine","Medium", "Other" ) 

Cool, OK, so the issue is that SWITCH didn't like specifying a column value to switch on and then coupled with a logical true/false statement. Makes sense.

@ 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...

Or maybe this:

 

SWITCH(Table1[Queue]
  "CSC EZTech","Programming Support",
  "CSC ","Programming Support",
  "Engine","Duty",
  "I6Engine","Medium",
  "Other"
)

@ 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
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.

Top Solution Authors