PREVIOUSQUARTER

The PREVIOUSQUARTER function returns a table containing a column with the dates corresponding to the quarter prior to the current context.

Syntax

PREVIOUSQUARTER(
    dates
)

Parameters
  • dates: Column containing dates.
Returned value

The PREVIOUSQUARTER function returns a table.

Additional Information

The dates argument can be a reference to a column containing dates, an expression that returns a table with a single column containing dates, or a Boolean expression that defines a table with a single column containing dates.

This function returns the set of dates corresponding to the quarter that precedes the dates involved in the current context. In other words, the set of dates returned by the function is never part of the current context.

Examples

If, given a table with sales, we define the measure:

Ventas = SUM(FactSales[SalesAmount])

...calculating the total sales, and the measure:

Ventas trimestre anterior = CALCULATE(
    [Ventas],
    PREVIOUSQUARTER(DimDate[Datekey])
)

...calculating the sales of the previous quarter, and we take both measures to a matrix in which we place months, quarters and years at the head of the rows, the result is the following:

PREVIOUSQUARTER function. Example of use

It can be seen how, for each month and each quarter, the result returned by the measure [Ventas trimestre anterior] actually coincides with the total sales of the quarter that precedes the current context. It can also be seen how the sales calculation for the previous quarter for the year 2008 (€ 894,947,792.23) is the total sales for the last quarter of 2007 (it has already been commented that the set of dates returned by the function is not included in the current context). For this reason, the measure does not return any value for the year 2007, as there is no data for the last quarter of 2006.

Category
Time intelligence
Submitted by admin on Tue, 12/04/2018 - 11:27