Quarter Versus Previous Quarter (Quarter over Quarter) Calculation in Tableau

By: Eric Parker

Pro Headshot.jpg

Eric lives in Seattle and has been teaching Tableau and Alteryx for 5 years. He's helped thousands of students solve their most pressing problems. If you have a question, feel free to reach out to him directly via email.

Imagine you are working in Tableau and want to create a worksheet that compares performance this quarter to date to performance last quarter to date. Depending on the visuals you’d like to create, you’ll likely need to create a calculated field for this to work properly.

First, we can create a calculation that returns only data from this quarter to date. Here’s what that would look like:

101-1.png

If you have multiple years of data in your dataset you need to ensure you’re only looking at data from this year, and then you want to only return sales values from this quarter.

Second, you need to create a calculation that only returns values from last quarter. This calculation is trickier. You need to make sure you are only returning values from the previous quarter and you need to make sure you’re only comparing to the most recent previous quarter number (i.e. if today is part of Q3 we want to compare to Q2 of this year but not Q2 from previous years).

101-2.png

The first line of the calculation figures out what the previous quarter number is and the second ensures we are only comparing against the most recent iteration of that quarter number.

The last calculation would compare the quarter to date values to the previous quarter to date values.

101-3.png

*Note that this calculation compares this quarter to all of last quarter. That means if today is the first day of the quarter, your calculation will compare the one day from this quarter to the 90 days from last quarter.

If you want to compare values from this quarter to the previous quarter to date, the previous quarter to date calculation needs to look like this:

101-3-5.png

Here’s what the parts of the calculation mean;

Line 1: We only want data from the previous quarter.

Line 2: We only want data from the most recent iteration of the previous quarter.

Line 3: Only return values from last quarter from when where we are at in relation to this quarter (i.e. if today is the 22nd day of the quarter we only want data from the first 22 days of last quarter).

Notice the difference in results:

101-4.png

Looking for help on your own calculation question? Sign up for an office hour today and we can help!