From the course: Tableau 10 for Data Scientists

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Calculate time durations

Calculate time durations - Tableau Tutorial

From the course: Tableau 10 for Data Scientists

Start my 1-month free trial

Calculate time durations

- [Narrator] In this example, we'll look at how we can use a calculation to find the difference between two order dates and then covert that into days, hours, minutes and seconds. First, let's have a look at our example data. We have a number of orders, the time it was ordered, and the time it was shipped. Now, we want to know duration between the order time and the shipping time. To do that, first we're going to calculate the number of seconds, then we're gonna convert the number of seconds into days, hours, minutes. The first step, we need to know the number of seconds between the time ordered and the time shipped. So let's create a calculated field and we're gonna use the DATEDIFF function. So DATEDIFF will take a part of a date, so we want to look at seconds. We need to give it the start date, so that's time ordered, and the end date, which is the time shipped. And we'll call this seconds. If we add this to our view, we can see the total number of seconds between the order date…

Contents