cancel
Showing results for 
Search instead for 
Did you mean: 
JoeM
Community Manager
Community Manager

Introduction

If you want to convert a date to a weekday name (Monday, Tuesday, Wednesday, etc.) there are two common approaches:

Use the Column Formatting Option

When dragging a date into a tray, open the settings to expose formatting options. In the date mask field, enter 'EEE' for an abbreviated weekday (Mon) and 'EEEE' for a full weekday name (Monday). More masking options are available here.

Bonus fact: based on the mask entered, you'll have a preview of the output in the date format dropdown!

JoeM_0-1692734365027.png

Use a Formula

To build a formula, look no further than the formatDate() built-in function.  For this formula to properly execute, you must provide a data column and the string mask of a desired format. 

formatDate(date exp,string mask)

Example:

formatDate(
	Online_Store.OrderDetails.OrderDate, 
	'EEEE'
)

Quick tip: instead of formatting the output data by trial and error, use the formatting method above until you get the correct mask set, then copy and paste it into the formula!

Important Differences between the two Methods

If the format option is used, the underlying date will be considered distinct and not aggregate at the weekday level. A formula will remove the underlying value, leaving the output to be aggregated by the day of the week. 

To best illustrate the difference - take these ten records:

JoeM_1-1692734721325.png

When applying format only on an aggregated table, the data will appear as:

JoeM_2-1692734767023.png

Notice that there are multiple instances of Thursday, Friday, and Saturday.

Now see what happens when the data is formatted with a formula:

JoeM_3-1692734851620.png

7 rows for 7 days!  Ensuring you choose the right method can drastically change the meaning of your analysis.

Resources

 

Best Practices Index
Best Practices

Just here to browse knowledge? This might help!

Contributors
Version history
Last update:
‎08-24-2023 02:49 PM
Updated by: