The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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 |
---|---|
26 | |
12 | |
8 | |
8 | |
5 |
User | Count |
---|---|
30 | |
15 | |
12 | |
12 | |
7 |