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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Sum of last year MTD

Hi Guys, 

 

I would like to find out the MTD sum of [TEU] but for last year instead. I have tried 

TEU_MTDLAST = CALCULATE([Total_TEU], SAMEPERIODLASTYEAR(DATESMTD(DateTable[Date]))) but it gives me the sum of the entire month of last year. For better visualisation, this is the sample data set: 
 
brendans7_1-1686046918274.png

 

My code gives me a sum of 100190 TEUes (which is the sum of 1/6/2022 to 9/6/2022). However, since today's date is 6/6/2023, I want to get the sum of TEU from 1/6/2022 to 6/6/2022 only. 

 

2 REPLIES 2
Mahesh0016
Super User
Super User

@Anonymous 

MTD =
CALCULATE (
    TOTALMTD ( SUM ( 'Table'[Value] ), 'Table'[Date] ),
    FILTER ( ALLSELECTED('Table'[Year]), 'Table'[Year] < MAX ( 'Table'[Year] ) )
)
 
@Anonymous I hope this help you ! THANK YOU !!
Anonymous
Not applicable

Unfortunately, I am still getting the same number (100190 TEUs), which is not what I am looking for. 

 

brendans7_0-1686059220920.png

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.