Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
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.
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.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
26 | |
12 | |
11 | |
9 | |
9 |
User | Count |
---|---|
17 | |
14 | |
13 | |
13 | |
12 |