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
sureshsonti
Helper II
Helper II

Current Year MTD vs Last Year MTD of Same Month

These are my fields in my Data Set. I am trying to avoid filters on the report.

Order Date
Year
Month
Location
Units Sold

 

1. I want to extract Units Sold Month To Date of Current Year based on Order Date
2. I want to extract Units Sold Month To Date (Last Year) based on the Order Date

 

Want to compare Units Sold Month To Date of Current Month and Last Year Month To Date of the Same Month using DAX formula. Trying to avoid filters on the report

 

Example December 2018 vs December 2017

 

Thanks for your help

 

Thanksdata.JPG

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

HI, @sureshsonti

You could use SAMEPERIODLASTYEAR  to create a Last Year MTD measure like below:

Current Year MTD = CALCULATE (     SUM('Table'[Units Sold]),      DATESMTD ( 'Date'[Date] ) ) 


Last Year MTD = CALCULATE (     SUM('Table'[Units Sold]),     SAMEPERIODLASTYEAR ( DATESMTD ( 'Date'[Date] ) ) ) 

Result:

1.JPG2.JPG

 

Best Regards,

Lin

 

Community Support Team _ Lin
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

3 REPLIES 3
v-lili6-msft
Community Support
Community Support

HI, @sureshsonti

You could use SAMEPERIODLASTYEAR  to create a Last Year MTD measure like below:

Current Year MTD = CALCULATE (     SUM('Table'[Units Sold]),      DATESMTD ( 'Date'[Date] ) ) 


Last Year MTD = CALCULATE (     SUM('Table'[Units Sold]),     SAMEPERIODLASTYEAR ( DATESMTD ( 'Date'[Date] ) ) ) 

Result:

1.JPG2.JPG

 

Best Regards,

Lin

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi @v-lili6-msft  Lin,

 

in your answer, could  the cummulative sum be cut off at certain period, say a given date?

 

i am trying to realize some kind of graphing for running sum, however in vain.

Could you kindly help look at it , if you have time?

link to Post 

 

Appreiciate your help!

Awesome. Thanks Lin

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.