TOTALMTD

The TOTALMTD function evaluates an expression from the first day of the month in the current context to the last day in the current context.

Syntax

TOTALMTD(
    expression,
    dates
    [, filter]
)

Parameters
  • expression: Expression that returns a scalar.
  • dates: Column containing dates.
  • filter: Optional argument. Filter to apply to the current context.
Returned value

The TOTALMTD function returns a scalar representing the expression given as the first argument evaluated for dates between the first day of the month in the current context and the last day in the current context.

Additional Information

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

The following functions are equivalent:

TOTALMTD(expression, dates[, filter])

CALCULATE(expression, DATESMTD(dates)[, filter])

Examples

If we consider the following table containing information on sales:

TOTALMTD function. Example of use

...we define the following measure:

Ventas = SUM(Ventas[Importe])

...and then we define the "Ventas MTD" measure that calculates the total sales from the beginning of the month of the current context to the last date of the current context:

Ventas MTD = TOTALMTD(
    Ventas[Ventas],
    Calendario[Fecha]
)

If we take this last measure to a matrix, we obtain the following result:

TOTALMTD function. Example of use

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

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