Extracting a Textual Representation of a Day of the Week Extracted from a Date

Dear Team,

I am seeking guidance on the process of converting an existing dateTime value into a textual (string) representation that indicates the respective day of the week.
for example “Aug 30, 2023” date will return just “Wednesday”.

My initial approach involved using the extract('DD', {dateField}) function, but this method yields an integer result rather than the desired textual representation.

To provide some context, my objective is to aggregate a specific field’s values over individual days and present the average for each day of the week within a specified time frame. For instance:

  • Monday: Average value of the field for all Mondays
  • Tuesday: Average value of the field for all Tuesdays

I appreciate your assistance in achieving this task effectively. Thank you.

Hi,

You can use extract together with switch to get the name of the day of the week.

switch(extract('WD',{Order Date}),1,"Sunday",2,"Monday",3,"Tuesday",4, "Wednesday", 5, "Thursday", 6, "Friday", 7, "Saturday","")

Hope this helps!

Kind regards,
Andres.

3 Likes

Thank you very much!

2 Likes