Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi everyone.
I am struggling abit with this running average.
Measure =
CALCULATE(
DIVIDE((SUM('Sheet1'[Aqua])*358),(sum('sheet1'[Wlk3]))),
FILTER(
ALLSELECTED('Sheet1'[Date]),
ISONORAFTER('Sheet1'[Date], MAX('Sheet1'[Date]), DESC)
)
)
It works really good, but I only want the calculation starting last year from MAX.
Since I have data from 3-4 years ago, which would not be relevant for me.
Is there a way to start the calculation from exactly 1 year ago?
Thank you so much in advance! 😀
Let me know if there is any other data I should show.
Solved! Go to Solution.
Hi @Astro1990 ,
As far as I know, DATESINPERIOD() will work if you have continuous date in your data model. So if there is continuous date in Sheet1, you will get correct result. You can add a dimdate table by CALENDAR() or CALENDARAUTO() with continuous date as well.
I think you can achieve your goal with Filter() function as well. Try this code.
Measure =
VAR _LASTDATE = MAXX(ALL(Sheet1),Sheet1[Date])
RETURN
CALCULATE(
DIVIDE((SUM('Sheet1'[Aqua])*358),(sum('sheet1'[Wlk3]))),
FILTER(
Sheet1,
Sheet1[Date] > EOMONTH(_LASTDATE,-12)
)
)
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you so much Rico!
It worked wonderfully!
I think I corrected it. Instead of Filter, I used DatesinPeriod.
It looks great! Still checking if it, so I'll post here once I finished checking.
FILTER(
ALLSELECTED('Sheet1'[Date]),
ISONORAFTER('Sheet1'[Date], MAX('Sheet1'[Date]), DESC)
)
)
To the following:
Hi @Astro1990 ,
As far as I know, DATESINPERIOD() will work if you have continuous date in your data model. So if there is continuous date in Sheet1, you will get correct result. You can add a dimdate table by CALENDAR() or CALENDARAUTO() with continuous date as well.
I think you can achieve your goal with Filter() function as well. Try this code.
Measure =
VAR _LASTDATE = MAXX(ALL(Sheet1),Sheet1[Date])
RETURN
CALCULATE(
DIVIDE((SUM('Sheet1'[Aqua])*358),(sum('sheet1'[Wlk3]))),
FILTER(
Sheet1,
Sheet1[Date] > EOMONTH(_LASTDATE,-12)
)
)
Best Regards,
Rico Zhou
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! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
143 | |
85 | |
66 | |
51 | |
45 |
User | Count |
---|---|
216 | |
89 | |
82 | |
66 | |
57 |