Showing results for 
Search instead for 
Did you mean: 
Super User
Super User

Re: Calculating Last Year with SUMX and DateAdd

I would add a Year column to your table:


Year = YEAR([Date])


Then in your LY calculation, create this variable:


VAR __year = MAX([Year])


And then in your SUMX just FILTER yoru table to [Year]=__year - 1

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

Proud to be a Datanaut!

Laz Member

Re: Calculating Last Year with SUMX and DateAdd

Hi @Greg_Deckler,


I had managed to achieve the outcome i was looking for in Power BI through going back to the Drawing Board.


All my issues were resolved once i imported at a Transaction ID level, instead of my lowest level being Barcode, which is essentially Product ID.


I can explain in more detail, but that would be pointless now. With that said, thank you for all your input Smiley Happy

Maikeru Regular Visitor
Regular Visitor

Re: Calculating Last Year with SUMX and DateAdd

Dear @Laz
I happen to be facing a similar issue as you (SUMX formula on a time intelligence function), and wouldl be interested if you could share the details of the solution.

Thanks in advance!



Helpful resources


How to Get Your Question Answered Quickly

Power BI Super User, Greg Deckler, explains

Summit North America

Power Platform Summit North America

Register by September 5 to save $200

Back to School Contest

Back to School Contest

Engage and empower students with Power BI!

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Top Ideas
Users Online
Currently online: 6 members 1,222 guests
Please welcome our newest community members: