Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi, I'm new here and I need some help.
I would like to calculate a "W-kee" rolling average over the last 3 rows in the table example as below:
So the result should be ((1+4+1)/3=2), but I don't know what DAX formula I need to use.
I think I should use something based on nonblank rows for the W-kee column but I really have no glue.
Please help.
Solved! Go to Solution.
Hi,
According to your description, I can roughly understand your requirement, you can try this measure to get the expected result:
Rolling average =
var _lastrow=CALCULATE(MIN('Table'[SPR]),FILTER(ALL('Table'),[W-kee]=BLANK()&&[W-def]=BLANK()&&[W-mid]=BLANK()&&[W-att]=BLANK()))
return
CALCULATE(AVERAGE('Table'[W-kee]),FILTER(ALL('Table'),[SPR]<=_lastrow-1&&[SPR]>=_lastrow-3))
And you can get what you want, like this:
You can download my test pbix file below
Thank you very much!
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
According to your description, I can roughly understand your requirement, you can try this measure to get the expected result:
Rolling average =
var _lastrow=CALCULATE(MIN('Table'[SPR]),FILTER(ALL('Table'),[W-kee]=BLANK()&&[W-def]=BLANK()&&[W-mid]=BLANK()&&[W-att]=BLANK()))
return
CALCULATE(AVERAGE('Table'[W-kee]),FILTER(ALL('Table'),[SPR]<=_lastrow-1&&[SPR]>=_lastrow-3))
And you can get what you want, like this:
You can download my test pbix file below
Thank you very much!
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Great, that's the one I'm looking for.
Much appreciated!
Hi @Anonymous ,
var Rolling Average= CALCULATE(Table[W-knee], FILTER(ALLSELECTED(Table[SPR]), ISONORAFTER( Table[SPR], MAX(Table[SPR]), asc)))
Return (Rolling Average/ 3)
Mark this as a solution, if I answered your question. Kudos are always appreciated.
Thanks
Hi @Anonymous
Try this measure:
Measure=
Var _MaxL = calculate(max(table[SPR]),filter(table,table[W-kee]<>""))
Var _MinL = _MaxL-2
return
Calculate(avarage(table[W-kee]),filter(table,table[SPR]>=_MinL &&table[SPR]<=_MaxL ))
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Hi @Anonymous
What is the format of [SPR] column?
Appreciate your Kudos!!
Whole number
Hi @Anonymous
Can you share your PBIX file with us (After removing sensetive data)?
Appreciate your Kudos!!
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
20 | |
7 | |
6 | |
5 | |
5 |
User | Count |
---|---|
26 | |
10 | |
10 | |
9 | |
6 |