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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Amount from previous years with same period

Hello everyone.

 

I try to calculate the amount of previous year with same day.

 

An example, we are the 03/02/2017, i want the amount between 01/01/2016 and 03/02/2016.

 

I try with different function :

LastYearMT = VAR 
    CurrentDate = NOW()
  RETURN
    CALCULATE( 
     SUM(Ventes[Montant]); 
     YEAR(Ventes[DATE]) = YEAR(CurrentDate)-1;MONTH(Ventes[DATE])<MONTH(CurrentDate)+1)

 

LastYearMT02 = VAR 
    CurrentPeriod = DATEDIFF(Date(Year(Now());1;1);now();DAY) RETURN
    CALCULATE( 
     SUM(Ventes[Montant]); 
    DATEDIFF(Date(Year(Now());1;1);Ventes[DATE];DAY)<=CurrentPeriod)

And now the result :

 

 

Have you some issues ?

 

Thank you so much.

0 REPLIES 0

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.