How to Round Date & Time Values

Sometimes, you want to round date values to a certain level like month, week, day, etc, so that you can aggregate the data flexibly.

In Exploratory, you can do it directly inside the chart.

But sometimes, you want to do it as a data wrangling step to create such data.

In such cases, select ‘Round’ -> ‘Round Date’ -> ‘Week’ from the column header menu if you want to round the date to the Week level..

This will populate ‘round_date’ function like below.

round_date(start_time, unit="week")

There are other functions to provide slightly different ways to ‘round’.

The ceiling_date function rounds up and the floor_date to round down the date and time values.

floor_date(start_time, unit="week")

The ‘floor_date’ is more commonly used.

Let’s say we have all different days of January 2020 in the data. With this function you can make all the dates to be January 1st, 2020.