Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply

MTD Calculation

Hi All,

I need your support; I am trying to calculate MTD,but it gives me inacurrate numbers, here the method I used:

=Calculate(SUM(COUNT),MONTH(Updated_Date)=MONTH(TODAY())

 I have used the quick measure in power bi, but it gave me a blanck result

And here is a sample of the data:

Product type userCountDateUpdated_Date
LaptopA202024-03-17T22:19:11.829Z2024-03-17
SpeakerC52024-03-17T14:34:36.922Z2024-03-17
LaptopC72024-03-17T13:28:05.836Z2024-03-17
LaptopE902024-03-17T13:23:58.907Z2024-03-17
LaptopA202024-03-18T22:19:11.829Z2024-03-18
SpeakerC52024-03-18T14:34:36.922Z2024-03-18
LaptopC72024-02-17T13:28:05.836Z2024-02-17
LaptopE902024-02-17T13:23:58.907Z2024-02-17
     
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Asmaa-elsheikh ,

I create a table as you mentioned.

vyilongmsft_0-1710921013235.png

When I write your DAX code, it gives me an error. I think you can change COUNT.

vyilongmsft_1-1710921176088.png

Then I change the DAX code, it gives me the result you want.

 

Measure =
CALCULATE (
    SUM ( 'Table'[Count] ),
    MONTH ( 'Table'[Updated_Date] ) = MONTH ( TODAY () )
)

 

vyilongmsft_2-1710921903762.png

 

 

 

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @Asmaa-elsheikh ,

I create a table as you mentioned.

vyilongmsft_0-1710921013235.png

When I write your DAX code, it gives me an error. I think you can change COUNT.

vyilongmsft_1-1710921176088.png

Then I change the DAX code, it gives me the result you want.

 

Measure =
CALCULATE (
    SUM ( 'Table'[Count] ),
    MONTH ( 'Table'[Updated_Date] ) = MONTH ( TODAY () )
)

 

vyilongmsft_2-1710921903762.png

 

 

 

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Yes, I need the mTD to show only values for March & to be dynamic to show the MTD per each coming month without the need to filter values manually each month, is there any way to do ?

Hi, yes, absolutely. Assuming you have a date dim table and have it marked as the date table, you would create your MTD measure with the quick measure and use the date from the date table in the measure. Then, put your date field from the date table in filters on the page (or entire report of you want) and set it to relative date, in this month. This will allow it to dynamically be in the correct month. 

1000011664.jpg





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





MNedix
Super User
Super User

Hi,

Why not using the built-in functions?

=CALCULATE(SUM(COUNT),DATESMTD(Updated_Date))


If the post helped then please give it a Kudos and mark it as the solution so others can see it.
Cheers,

I have used it, but gives me blank values 

audreygerred
Super User
Super User

Hello! The quick measure works for me. If you are trying to show data for only March, make sure you are filtered to March, otherwise it will be blank since PBI doesn't know which month you want the MTD for. 

 

Here is a table when I have the month in rows and am using the MTD measure:

audreygerred_0-1710873279430.png

Here it is without Month in rows, but I am filtered to March:

audreygerred_1-1710873335198.png

 

Here it is when I am not filtered to any month:

audreygerred_2-1710873373786.png

 

The measure I used: 

Count MTD =
IF(
    ISFILTERED('DateDim'[Date]),
    ERROR("Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column."),
    TOTALMTD(SUM('FactTable'[Count]), 'DateDim'[Date])
)

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.