PARALLELPERIOD DAX Function
The PARALLELPERIOD function returns a table that contains a column of dates that represents a period parallel to the dates in the specified dates column, in the current context, with the dates shifted a number of intervals either forward in time or back in time.
Note: In DAX, the PARALLELPERIOD function returns full periods at the given granularity level.
DAX Syntax PARALLELPERIOD(dates, number_of_intervals, interval)
The function takes the following parameters:
- dates : A column that contains dates.
- number_of_intervals: An integer that specifies the number of intervals to add to or subtract from the dates. If the number specified for number_of_intervals is positive, the dates in dates are moved forward in time; if the number is negative, the dates in dates are shifted back in time.
- interval: The interval by which to shift the dates. The value for interval can be one of the following: year, quarter, month.
Example: Create a measure.
DAX
Sum of PARALLELPERIOD income = CALCULATE(SUM(Sheet8[Annual Income]), PARALLELPERIOD('Sheet8'[Year],-1,YEAR))
For example, if the current date in the dates column is 7 July 2008 the above DAX function returns all the dates of the year 2007 i.e., from 1st Jan 2007 to 31st December 2007.