From the course: Tableau: Mastering Calculations

Unlock the full course today

Join today to access over 24,200 courses taught by industry experts.

Calculating simple intervals between two points in time

Calculating simple intervals between two points in time - Tableau Tutorial

From the course: Tableau: Mastering Calculations

Calculating simple intervals between two points in time

We are interested in the distance between two dates. For example, we want to know how long it takes us to dispatch an order after purchase. So let's create a field, processing time in days. We want to calculate the difference between the date of purchase and the date of shipping. Both fields are present in our data source. First, the customer purchases an order, then we ship it to the customer. We could just enter [date of shipping] - [date of purchase]. And this works. The calculation is valid. The problem is, what if only a certain aspect of the interval is relevant to us? Not days, but for example, hours if we have the time information. Or what if we want to know which orders were not shipped until the following month for accounting purposes? Let's take a look at the list of date functions. DATEDIFF sounds like it could be helpful. This function returns the difference between two dates where start date is subtracted from end date. Perfect. Let's use DATEDIFF. We can see that the…

Contents