Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hello Community,
I have a datatable where we have sales and profit for different items for different years.
Now, the ask is that "Sales" should be calculated only when the "Item name" exists for the previous year. Also, we dont have a date/calendar table.
Example:
When "A" is selected under "Item" and "2022" is selected from Year silcer. Sales value should be 100.
when Year "2021" is selected Sales should be 200 (Apple)+100 (Papaya) = 300
Item | Item name | Year | Sales | Profit |
A | Apple | 2022 | 100 | 200 |
A | Apple | 2021 | 200 | 400 |
A | Apple | 2020 | 500 | 1000 |
A | Papaya | 2021 | 100 | 400 |
A | Papaya | 2020 | 40 | 160 |
V | Cucumber | 2022 | 150 | 500 |
V | Cucumber | 2021 | 250 | 800 |
Is it possible to achieve this in power bi - dax?
Thanks for your help in advance.
Solved! Go to Solution.