The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
79 | |
70 | |
48 | |
41 |
User | Count |
---|---|
139 | |
112 | |
72 | |
64 | |
62 |