This timeline comparison is a useful technique to compare the value of a measure in different timeline periods. For example, we can compare the sales of the last month against another user-defined period. The two time periods may have a different number of days, like comparing one month against a full year. When the durations of both time periods are different, we should adjust the values to make a true and fair comparison.
Timeline Comparison
The user selects two different time periods. The sales in the current period and in a comparison period. The sales of the comparison period must adjust using the number of days in each period as the allocation.
In order to enable the choice of two very different time periods, the model must contain two date tables: one to select the current period, one to select the comparison period. The additional Comparison Date table is linked to the original Date table with inactive relationship. This simplifies the handling of relationships with other fact in the tables.
Excel timeline template
When a measure evaluates an expression to filter the Comparison Date table, the measure expression activates the relationship between Comparison Date and Date; it also performs filters on Date table in order to use – in Sales – the filter from Comparison Date. Using this, any existing measure can compute the value in the current or comparison period with a simple change in the active relationship.
In order to adjust the value of Comparison Sales Amount, we need to follow an allocation method. In the example we use the number of days in the two periods as allocation factor. The business logic may dictate that only working days use for adjustment. In other words, a different adjustment logic is possible and depends on the requirements of the business over the period.