PARALLELPERIOD – travelling in time (DAX – Power Pivot, Power BI)
This is about the PARALLELPERIOD function, providing values from previous or following periods.
It provides information like these:
- Total values 4 months ago
- Average values 5 years ago
- Count of values in following quarter
It´s syntax is similar to other time intelligence functions:
- Year before = CALCULATE(SUM('My table'[My values]);PARALLELPERIOD('My table'[Date];-1;YEAR);ALL('My table'))
PARALLELPERIOD has three arguments:
- Date used for definition of time periods
- Number of periods - positive goes to future, negative goes to history
- YEAR, QUARTER or MONTH - which period are we going to use
It has to be added:
- PARALLELPERIOD can work similarly to functions like PREVIOUSYEAR, NEXTYEAR etc, but is more general - can move by more periods.
- As you can see in table, PARALLELPERIOD used for year works differently then SAMEPERIODLASTYEAR. If you use it, for example, for March 2019 the SAMEPERIODLASTYEAR, you will get values from March 2018. But if you use PARALLELPERIOD in this case, you will get values for 2018 total.