Showing posts with label Analysis Period. Show all posts
Showing posts with label Analysis Period. Show all posts

Saturday, May 25, 2024

Tableau - Analytical Calendar Attempt

 Post Index

Analytical Calendar The Story

2024-05-25

Analytical Calendar

Applying in Tableau

How to implement in Tableau

This post is to provide you an idea how to implement Analytical Calendar in Tableau.  Or more directly, it is how I try to put the Analytical Calendar into Tableau for an attempt so that Tableau can also enjoy the simplicity of the analysis and comparison periods as well as the simplified selections to navigate with the time.

In order to implement Analytical Calendar is not straightforward.  It cannot direct plug in and use.   And a few tuning is required and it also requires to understand deeper of Tableau.

In the following, I will share what I have encountered and what I have done.  Let's start!


Differences in Tableau

First of all, the design of tableau is quite different from Power BI and Qlik.  The major difference is that it is query-based.  What it means is that any data required from the data sources, it triggers a query.  It uses joins regarding to the data model.  No matter it is a filter, a measure calculation, etc, it has its own mechanism to get data from the data sources.  Even if it is using Extract, it is still query-based.

This means for Analytical Calendar, it requires a way to facilitate a fast way to retrieve data such that it can reduce the time and resource require to link up the required period data.

Another headache difference is that Tableau is unable to override filters.   Once it has been configured in the worksheet, it does not have any methods to override the filter values.   Tableau has a hierarchy of filtering from Extract, Data Source, Context, Dimension, Measure to Table as illustrated below.

https://www.thedataschool.co.uk/tristan-kelly/different-types-of-filters/


Although you might find LOD to help but it can only ignore dimension in the worksheet dataset.  As a result, it is not freely for you to control "N/A" or the Comparison Perspective as what you want.


New Design to Adapt Tableau

With the limitations or the differences in Tableau, the Analytical Calendar design has to be updated and make a bit different compared to Power BI and Qlik in order to adapt to Tableau.

In the latest version of Analytical Calendar, only three elements are required to be selected including Analysis Perspective, Unique Date and Comparison Perspective and in measures, we did the trick to modify the Comparison Perspective to "N/A" in order to make an analysis period selection.  However, Tableau isn't able to achieve the same.

In Tableau Analytical Calendar design, the three fields are remained but the selection of these three fields are not directly as what you selected.  Instead, each pair of selection will associate together with both Analysis Period and Comparison Period.  This is to overcome the filter limitation in Tableau.  Such that, in the worksheet, you are able to control to show the Analysis Period or the Comparison Period by the additional field called Calendar Control.

The below diagram illustrated an example of the design:


In the example, You are looking for 2024-05-20 (Actual Date) to compare 1 day before.  This selection, in the data model, is associating with two Date Range Key, i.e. Analysis Period and Comparison Period.  In tableau measures, it can control to use Calendar Control = 'ANALYSIS' for analysis period while Calendar Control = 'COMPARISON; for comparison period.  Although it increases the number of rows, because we are only a limited combinations of selection of the Analytical Calendar three core fields, it greatly narrows down the required rows in joining.  Overall, only a little resource is required to compensate the Tableau design limitation.


Tableau Analytical Calendar Template

I have also put the Tableau template in https://github.com/kongson-cheung/analytical-calendar/blob/main/Tableau%20Analytical%20Calendar%20Examples/AnalyticalCalendar6.0_Tableau.twbx.

Please have a try and let me know your comment.


Below are the screen captures of the template.  It does not have nice visual as the focus is to show the usage of Analytical Calendar.

The same layout is developed in Tableau similar to Qlik and Power BI.

The beauty of Analytical Calendar is that you are free to travel with time on analysis period and its comparison period.  Single presentation can already satisfy YoY, MoM, YTD, etc.



Thank you for reading.  I hope it help.  Leave me message if you have any discussion or want to share your views.