Forum Discussion
Expression error: The name 'SWITCH' wasn't recognized. Make sure it's spelled correctly.
- 10 years ago
Ahhhh, that's the problem. Switch is a DAX formula, but you are trying to use it in Power Query, which uses the Power Query Formula Language (PQL)
Maybe this is a silly question, but are you putting an equal sign first? It is not in your formulas. Also, your test seems to be a text test, but you say it is a time column. Try using the time function in place of the text representation of the time. https://msdn.microsoft.com/en-us/library/ee634564.aspx
MattAllington Yes , i used an equal sign , sorry did not copy that. And one more thing i am using Add Custom Column in Edit Queries.
- MattAllington10 years agoCommunity Champion
Ahhhh, that's the problem. Switch is a DAX formula, but you are trying to use it in Power Query, which uses the Power Query Formula Language (PQL)
- sanchit10 years agoFrequent Visitor
MattAllington Oh... I did not know that. Thanks for your help. I added a new column in Table Format it worked :)
This is what i used :
Column = SWITCH(TRUE(),
AND([EventTime]>=TIMEVALUE("09:30:00 AM"), [EventTime]<=TIMEVALUE("10:00:00 AM")), "Peak Hours",
"Non Peak Hours"
)