Hi everyone, welcome back to my blog. Last week I shared with you how to parse messy text data using Alteryx and I hope you enjoy the tutorial. This week’s blog post will be about data visualisation using Tableau. I will blog interchangeably between Alteryx and Tableau. It will be one week for Alteryx and one week for Tableau. Now let get right into this week’s tutorial on ‘How to build an interactive line chart comparing across quarters’ in Tableau.¬† In this chart, the users could choose the year and quarter they want and comparing it to the previous quarter and the same quarter last year. The data I am using in this tutorial is the sample superstore which leaves the link below. Now let’s talk less and dive into building our chart.

Step 1 – Create Year and Quarter Parameter

–¬† Create 2 calculated fields [Year] and [Quarter] then create 2 parameters from them

 

Step 2 – Create calculated fields

These are calculated fields that we need to create in order to create a [Week #] for columns and to colour our selected quarter and the ones we want to compare to

[Week #]

INDEX()

[Labels]

IF [Year] = [Year Parameter] AND [Quarter] = [Quarter Parameter] THEN ‘Selected Year Selected Quarter’
ELSEIF [Year] = [Year Parameter] AND [Quarter] = [Quarter Parameter] – 1 THEN ‘Selected Year Previous Quarter’
ELSEIF [Year] = [Year Parameter] – 1 AND [Quarter] = [Quarter Parameter] THEN ‘Previous Year Selected Quarter’
ELSE ‘Others’
END

Step 3 РBuilding  the chart

Hooray! We have created all of the necessary calculations. Now it is time to put them all together

 

Step 4 – Formating

Yeah, we got our chart ready for formatting now. We just need to define the colours for different labels, deleting unnecessary grid lines, and editing the tooltips and we are done.

 

Thank you for following along with me. I hope you enjoy the tutorial. If you find the tutorial is useful or if you have any other methods of creating this chart please drop me a comment. I will see you all next week

 

Quyen Ha
Author: Quyen Ha