Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello experts.
I have a very simple table, but I'd like to find the moving average for the laxt 3 events. I see a lot of data for moving averages using dates, but Im struggling to get to the root of the expression for these event#s. Thanks in advance!
Event# | RevCat1 |
294 | $0.09 |
295 | $0.05 |
296 | $0.11 |
297 | $0.08 |
298 | $0.04 |
299 | $0.07 |
300 | $0.02 |
301 | $0.03 |
302 | $0.04 |
303 | $0.03 |
304 | $0.08 |
305 | $0.08 |
306 | $0.19 |
307 | $0.10 |
308 | $0.09 |
309 | $0.15 |
310 | $0.12 |
Solved! Go to Solution.
Since you have a continuous range of numbers for your events, we can take the average of the RevCat1 column where the Event# is greater than the current row's Event# - 3 and less than or equal to the current row's Event#. In DAX for a new measure:
MovingAvg = CALCULATE(AVERAGE(TableName[RevCat1]), FILTER(ALL(TableName), TableName[Event#] > MAX(TableName[Event#) - 3), FILTER(ALL(TableName), TableName[Event#] <= MAX(TableName[Event#])))
Since you have a continuous range of numbers for your events, we can take the average of the RevCat1 column where the Event# is greater than the current row's Event# - 3 and less than or equal to the current row's Event#. In DAX for a new measure:
MovingAvg = CALCULATE(AVERAGE(TableName[RevCat1]), FILTER(ALL(TableName), TableName[Event#] > MAX(TableName[Event#) - 3), FILTER(ALL(TableName), TableName[Event#] <= MAX(TableName[Event#])))
Thanks!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
115 | |
100 | |
88 | |
68 | |
61 |
User | Count |
---|---|
152 | |
120 | |
102 | |
87 | |
68 |