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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Need to find TOTALQTD for Previous year

Hi All,

I have calculated the below DAX measures which is working fine

  • Revenue/Spend=Sum(Revenue)/Sum(Spend)
  • Current QTD =TOTALQTD([Revenue/Spend],'DateDIM'[End of Week])
  • Previous QTR QTD=Calculate([Revenue/Spend],PREVIOUSQUARTER('DateDIM'[End of Week]))

I need to find the TotalQTD for Previous Year same period. I have a date slicer which has week ending dates. 

 

DAX what I am using for it:

  • PY QTD=Calculate([Revenue/Spend], PARALLELPERIOD(DATESQTD('DateDIM'[End of Week]),-1,YEAR)) .

But this PY QTD results are not coming correct. Kindly help.

 

Thanks in Advance

 

1 ACCEPTED SOLUTION

Hi,

 

Try using the SAMEPERIODLASTYEAR 

The Dax might look like this.

PY QTD=Calculate([Revenue/Spend], SAMEPERIODLASTYEAR('DateDIM'[End of Week]))

Please mark it as the solution if this works. 

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

Please find an example

QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD('Date'[Date Filer]))
 Last year Qtr Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(ENDOFQUARTER(dateadd('Date'[Date Filer],-12,MONTH))))  // Use end of qtr only if required

 

PY QTD=Calculate([Revenue/Spend], (DATESQTD(dateadd('DateDIM'[End of Week],-1,YEAR)))

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.

My Recent Blog - https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

@amitchandak 

Hey Amit, Thanks for your help.

No luck witk this DAX though.

PY QTD = Calculate([Revenue/Spend], (DATESQTD(dateadd('DateDIM'[End of Week],-1,YEAR))))

I found the solution. Below DAX is giving me correct results

PY QTD = Calculate([Revenue/Spend], SAMEPERIODLASTYEAR(DATESQTD('DateDIM'[End of Week])))
 
Thanks for sharing your Blog.

Hi,

 

Try using the SAMEPERIODLASTYEAR 

The Dax might look like this.

PY QTD=Calculate([Revenue/Spend], SAMEPERIODLASTYEAR('DateDIM'[End of Week]))

Please mark it as the solution if this works. 

Anonymous
Not applicable

@VipulToshniwal 

Hi Vipul,

Thanks for your quick response.

This works for me.

PY QTD = Calculate([Revenue/Spend], SAMEPERIODLASTYEAR(DATESQTD('DateDIM'[End of Week])))
 
Thanks!

Hi @Anonymous ,

 

Would you kindly mark my DAX the solution? That will help others quickly get to it. Thank you.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.