Forum Discussion

indhu's avatar
indhu
Helper III
8 years ago
Solved

custom column with switch statement

Hi,    I would like to know if there is any way to create a custom column with a switch statement.   Requirement -> I have a date column and wanted to calculate the day of week column with a name...
  • anithat's avatar
    anithat
    8 years ago

    indhu

     

    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.