TOTALMTD

How to Use the Power BI DAX function TOTALMTD

What is TOTALMTD?

TOTALMTD is a DAX function that returns the total value of a measure for the current month-to-date period. It takes two arguments: the name of the measure you want to calculate, and the name of the date column that contains the dates for which you want to calculate the total. For example, if you have a Sales measure and a Date column, you can use TOTALMTD to calculate the total sales for the current month-to-date period.

How to use TOTALMTD

To use TOTALMTD, you need to follow a few simple steps:

1. Open your Power BI report and go to the page where you want to add the calculation.

2. Click on the “New Measure” button in the “Fields” pane.

3. In the formula bar, enter the following formula:


Total Sales MTD = TOTALMTD(Sales[SalesAmount],Date[Date])


In this example, we're calculating the total sales for the current month-to-date period using the SalesAmount measure and the Date column.

4. Press Enter to create the measure.

5. Drag and drop the new measure onto your report canvas to display the total sales for the current month-to-date period.

Understanding the TOTALMTD formula

The TOTALMTD formula has two arguments: the first argument is the name of the measure you want to calculate, and the second argument is the name of the date column that contains the dates for which you want to calculate the total.

In our example, we used the SalesAmount measure and the Date column. However, you can use any measure and date column that are relevant to your report.

Using TOTALMTD with other DAX functions

TOTALMTD is a versatile function that can be used in combination with other DAX functions to create more complex calculations. For example, you can use TOTALMTD with the SAMEPERIODLASTYEAR function to calculate year-over-year changes in sales for the current month-to-date period.

Here's an example formula that uses TOTALMTD and SAMEPERIODLASTYEAR:


Sales YoY MTD = DIVIDE(TOTALMTD(Sales[SalesAmount],Date[Date])-TOTALMTD(SAMEPERIODLASTYEAR(Date[Date]),Sales[SalesAmount]),TOTALMTD(SAMEPERIODLASTYEAR(Date[Date]),Sales[SalesAmount]))


This formula calculates the year-over-year change in sales for the current month-to-date period. It subtracts the total sales for the same period last year from the total sales for the current period, and divides the result by the total sales for the same period last year.

The TOTALMTD function is a powerful tool in the DAX language that allows you to calculate the total value of a measure for the current month-to-date period. By using TOTALMTD in combination with other DAX functions, you can create more complex calculations and gain deeper insights into your data. With the steps outlined in this article, you should be able to start using TOTALMTD in your own Power BI reports and dashboards.

Power BI DAX Training Courses by G Com Solutions (0800 998 9248)

Upcoming Courses

Contact Us

    Subject

    Your Name (required)

    Company/Organisation

    Email (required)

    Telephone

    Training Course(s)

    Your Message

    Upload Example Document(s) (Zip multiple files)