TOTALMTD DAX Function in Power BI

The TOTALMTD DAX function evaluates the value of the expression for the month to date, in the current context. "MTD" stands for "Month-to-Date," so TOTALMTD calculates a total for the current month up to the current date.

DAX Syntax TOTALMTD(expression, dates[,filter])

The function has the following parameters:

Example: Let’s create a measure with name "TOTALMTD Measure".

DAX

TOTALMTD Measure = TOTALMTD(SUM(Sales[Profit]), Sales[Date])

The output of the above dax code is shown below:

TOTALMTD dax function in Power BI

Every start of the month the expression is reevaluated as shown below:

TOTALMTD dax function in Power BI

Note: In the bottom the value 36934 is the latest total Month to date value.

When we add any categorical column then the measure is filtered with this context.

TOTALMTD dax function in Power BI

Here, on 5th January 2023 the value in the TotalYTD Measure is 1021 which is the sum of the 252 and 769 value as both are of the same categorical value as Category column value applies the filter on the TotalYTD Measure.

To remove the categorical filter context on the measure we can modify the dax formula:

DAX

TOTALMTD Measure = 
    TOTALMTD(
        SUM(Sales[Profit]), 
        Sales[Date], 
        ALL(Sales[Category])
    )    

The output of the above dax code is shown below:

TOTALMTD dax function in Power BI