Forum Discussion
custom column with switch statement
- 8 years ago
Then the Switch statement that you mentioned is working perfect right?
In this case as well, create two columns
Name of Day
= SWITCH(
WEEKDAY(table[Date],2),
1,"Monday",
2,"Tuesday",
3,"Wednesday",
4,"Thursday",
5,"Friday",
6,"Saturday",
7,"Sunday")and
Day of Week = WEEKDAY(table[Date],2)
Then use Sort by column option as suggested before.
create two columns
Day of Week which gives numeric value
Name of Day which gives Name
Apply & close
Go to 'Data' or 'Report' tab (on left side )
Go to 'Modelling' tab (on Top)
Choose the column "Name of Day"
Click on 'Sort by Column'
From the dropdown list choose "Day of Week" and that will sort the "Name of Day" by "Day of Week"
anithat thanks for your suggestion. The database is very huge and the refresh time now takes about 20-30 mins. I reckon adding one more column will add up the load.
Is there any way I can use the switch statement in power query?
I will test the refresh time for both as well.
- anithat8 years agoResolver II
Then the Switch statement that you mentioned is working perfect right?
In this case as well, create two columns
Name of Day
= SWITCH(
WEEKDAY(table[Date],2),
1,"Monday",
2,"Tuesday",
3,"Wednesday",
4,"Thursday",
5,"Friday",
6,"Saturday",
7,"Sunday")and
Day of Week = WEEKDAY(table[Date],2)
Then use Sort by column option as suggested before.