Forum Discussion
sanchit
10 years agoFrequent Visitor
Expression error: The name 'SWITCH' wasn't recognized. Make sure it's spelled correctly.
Hi I am trying to create a custom column on “Time Column” using Switch. Format of Time Column-"10:30:00 AM". Desired Output : If Time is between “08:30:00 AM” and “10:30:00 AM" then “Peak Hours”...
- 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)
MattAllington
10 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)
sanchit
10 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"
)