DATESQTD

The DATESQTD function returns a table with a single column that contains the dates from the beginning of the quarter of the current context to the last date of the current context.

Syntax

DATESQTD(
    dates
)

Parameters
  • dates: Column containing dates.
Returned value

The DATESQTD 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.

The current quarter always starts on the 1st day of the first month of the quarter (not customizable).

This function considers the last day of the current context and returns a table containing all the dates from the first day of the quarter to which that day belongs to this last day. This means that if more than one quarter is involved in the current context, only the last one is considered.

Depending on the context in which it is used, the result may not be as expected. In such a case, we must make sure that we have marked the calendar table as "date table" (by selecting the table in the Fields column and executing the Table Tools > Calendars > Mark as date table command):

Mark as date table
Examples

The following sales table is considered in this example:

DATESQTD function. Example of use

We define the Ventas measure:

Ventas = SUM(Ventas[Importe])

...and then we create the Ventas QTD measure that calculates accumulated sales since the beginning of the quarter:

Ventas QTD = CALCULATE(
    Ventas[Ventas],
    DATESQTD(Calendario[Fecha])
)

If we take these measures to a matrix, we obtain the following result:

DATESQTD function. Example of use

It can be seen how the measure is reset to zero at the beginning of each quarter.

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