Sorting by weekday in a visualization

The following post is about creating a visualization with information by weekday, and going through and sorting this.

When trying to create a visualization based off information for each weekday, you may see an issue with the sorting of this information. The names of each weekday will automatically be sorted alphabetically, however we can counteract that with a switch statement.

The first step is to get the weekday of each date, which can be done with the WeekdayName formula:

image

We can then group this column. Next, create a new column within this grouping that will be used to sort. This can be done with a switch statement, such as this:

Switch([Weekday], "Monday", 1, "Tuesday", 2, "Wednesday", 3, "Thursday", 4, "Friday", 5, "Saturday", 6, "Sunday", 7)

Now, we can create the child visualization and select the Weekday as the X-axis. We can then use the custom sorting option to sort based off the column we created from the switch statement.

image
image

Which gives the final result!

3 Likes