Tableau PCP: How to easily compare apples with apples

I first ran into the term PCP in reference to a hallucinogenic drug also known as ‘Angel Dust’ – which often results in users punching through car windscreens without feeling any pain.  Thankfully, my latest association with PCP has nothing to do with that.

pcp-article

The PCP I’m talking about is short for Prior Comparison Period. In data terms – this means comparing metrics for the current period of time against a prior period of time.  This might mean sales this year to date vs sales last year up to the same date, or last quarter against the quarter before that. Whatever the comparison, PCP generally refers to a similar period of time. – i.e. apples v apples. Those of you in BI circles who have long been working with Analytics cubes, and involved with building data warehouses know exactly what i’m talking about.

In the past number of years, I have been lucky enough to develop Tableau datasources alongside my data team (here at MIP) – which are based upon date dimensions in my star schema data layer.  This date dimension provide tonnes of attributes like Prev_Fin_Yr and Curr_Qtr etc.  These attributes make it quite easy to develop  dashboards that allow BI end users to slice and dice their metrics and compare whatever time periods they like.

However, in the modern age of self-service analytics, a) the data layer is often quite thin and b)  the expectations of end users re date ranges go way beyond a standard MTD and YTD offering.  This means that all you see in your data layer is ‘Date’ and all of the comparative date attributes are required to be developed in the reporting layer and calculated at run-time.

So – there was no surprise that I recently found myself in a project role as Tableau Developer for a Digital Advertising Agency client and having to pull out my trick-bag of PCP calculations and update them for some additional tricky requirements. This client was keen on a wide variety of user selectable PCP’s such as ‘Last 30 days vs 30 days prior‘ ,’Yesterday vs The Day before Yesterday‘ and ‘Last Week vs the Same Week last year‘ to name a few.

Once I had put the effort in to develop a nice bag of parameter driven date attributes – I thought I  would retrofit them to a SuperStore datasource – and share them with the Tableau Community.

So accordingly – I have put together a YouTube video of the why and how of PCPs for Tableau.

pcp-youtube

And I have of course also uploaded a sample workbook featured in the video to Tableau Public – that can be downloaded and used to create your own PCPs!

pcp-tableau-public

Please enjoy

cheers

Craig Dewar

 

Leave a comment