PARALLELPERIOD function


Advertisements

Description

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.

Syntax

PARALLELPERIOD (<dates>, <number_of_intervals>, <interval>) 

Parameters

Sr.No. Parameter & Description
1

dates

A column that contains dates.

2

number_of_intervals

An integer that specifies the number of intervals to add to or subtract from the dates.

3

interval

The interval by which to shift the dates.

The value for interval can be one of the following −

  • Year
  • Quarter
  • Month
  • Day

Return Value

A table containing a single column of date values.

Remarks

DAX PARALLELPERIOD function takes the current set of dates in the column specified by dates, shifts the first date and the last date the specified number of intervals, and then returns all contiguous dates between the two shifted dates.

If the interval is a partial range of month, quarter, or year, then any partial months in the result are also filled out to complete the entire interval.

The dates parameter can be any of the following −

  • A reference to a date/time column.

  • A table expression that returns a single column of date/time values.

  • A Boolean expression that defines a single-column table of date/time values.

Constraints on Boolean expressions −

  • The expression cannot reference a calculated field.

  • The expression cannot use CALCULATE function.

  • The expression cannot use any function that scans a table or returns a table, including aggregation functions.

However, a Boolean expression can use any function that looks up a single value, or that calculates a scalar value.

If the number specified for number_of_intervals parameter is positive, the dates are moved forward in time. If the number is negative, the dates are shifted back in time.

The interval parameter is an enumeration, not a set of strings. Hence, the values for interval should not be enclosed in quotation marks. Also, the values: year, quarter, month, day should be spelled in full when using them.

The result table includes only dates that are specified in the dates parameter.

If the dates in the current context do not form a contiguous interval, the function returns an error.

Example

Previous Year Sales:= CALCULATE ( 
   SUM (Sales[Sales Amount]), 
   PARALLELPERIOD (Sales[Date], -1,YEAR)
) 
dax_functions_time_intelligence.htm

Useful Video Courses


Video

Mastering DAX and Data Models in Power BI Desktop

53 Lectures 5.5 hours

Abhay Gadiya

Video

Mastering DAX Studio

Featured

24 Lectures 2 hours

Randy Minder

Video

DAX / Power BI - Customer and Sales Analysis Deep Dive

26 Lectures 4.5 hours

Randy Minder

Advertisements