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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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!:
Mastering Power BI 2nd Edition

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!:
Mastering Power BI 2nd Edition

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!:
Mastering Power BI 2nd Edition

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!:
Mastering Power BI 2nd Edition

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!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors