Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
I am trying to get the sales of Previous Year but somehow previousyear function is not giving me the desired result. [LY Sales Col] is my previous year sales column.
Solved! Go to Solution.
You need to create a calendar table and create relationship between these two tables with Date key. Then use PREVIOUSYEAR Function (DAX) like below.
LY Sales = CALCULATE ( SUM ( SALESSHEET[Sales] ), PREVIOUSYEAR ( 'Calendar'[Date] ) )
Best Regards,
Herbert
You need to create a calendar table and create relationship between these two tables with Date key. Then use PREVIOUSYEAR Function (DAX) like below.
LY Sales = CALCULATE ( SUM ( SALESSHEET[Sales] ), PREVIOUSYEAR ( 'Calendar'[Date] ) )
Best Regards,
Herbert
Thanks for the prompt response. Your solution worked like a charm!
I have tried changing the column for previousyear function still it is not working
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
92 | |
87 | |
84 | |
66 | |
49 |
User | Count |
---|---|
140 | |
114 | |
110 | |
59 | |
59 |