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.
Hi everyone
I want to sum the stock value before 2 years from the selected year , for example if the selected year is 2024 i want to get stock in 2022 and if the selected year is 2023 I want to get 2021 value and so on
I useed these measures to calculate the selected year and last year
this yearstock =
last yearstock =
Solved! Go to Solution.
Hi @Wadda7AboUdai ,
Thanks for reaching out!
I understand you want ignore the filtering of the month. My workaround is to create a separate table contains years.
I've created a sample for your reference:
Sample data:
1.Create a separate year table.
2.Create a measure to return previous data and ignore month filtering.
Previousyear = CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),YEAR([Date])=SELECTEDVALUE('Table (2)'[Year])-1))
Thisyear:
Thisyear=CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),YEAR([Date])=SELECTEDVALUE('Table (2)'[Year])))
You can check more details by downloading the attachment.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous thank you for your help
Hi @Wadda7AboUdai ,
Thanks for reaching out!
I understand you want ignore the filtering of the month. My workaround is to create a separate table contains years.
I've created a sample for your reference:
Sample data:
1.Create a separate year table.
2.Create a measure to return previous data and ignore month filtering.
Previousyear = CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),YEAR([Date])=SELECTEDVALUE('Table (2)'[Year])-1))
Thisyear:
Thisyear=CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),YEAR([Date])=SELECTEDVALUE('Table (2)'[Year])))
You can check more details by downloading the attachment.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
User | Count |
---|---|
14 | |
10 | |
7 | |
6 | |
5 |
User | Count |
---|---|
30 | |
19 | |
12 | |
7 | |
5 |