Compare Custom Periods of Time

by martin.matejka@keboola.com

You probably know how you can compare data between weeks, month etc. and how Disconnected Date Dimension work (if not, read this). But maybe you don't know how to compare user specified period of time against the same range of dates before this selected period. And that's where the DDD knowledge mentioned before comes in.

Imagine that you want to compare four selected days against previous four days (to follow one of the example screenshots below, it could be 2014/06/25 - 2014/06/28 against 2014/06/21 - 2014/06/24). It's not any usual period of time (like week or month), so you can't use something like FOR PreviousPeriod.

To solve this issue just follow these steps:
  1. To create metric showing values for selected period (let's call it ThisPeriod), use standard DDD approach.
    1. Filtering metric used to filter data by DDD filter looks like this: 
    2. And ThisPeriod metric then looks like this: 
  2. Now you need to create PreviousPeriod metric with it's _BOP and _EOP values moved back by the difference between _BOP and _EOP. Then it will compare any date ranges you can imagine.
    1. Filtering metric will be little adjusted (it's just simple math): 
    2. And for PreviousPeriod metric you just use this new filtering metric: 
  3. And that's it. All sou need to do is place the report and DDD date filter on the dashboard. On the screenshots below you can see two examples of comparing four days against previous four days and ten days against previous ten days. 
         

And that's it. You can choose i.e. 247 days to compare, it doesn't metter. Eat that, time comparisons!
Comments