Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Anonymous
Not applicable

Moving Averages on non-date data

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
1 ACCEPTED SOLUTION
KGrice
Memorable Member
Memorable Member

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#])))

View solution in original post

2 REPLIES 2
KGrice
Memorable Member
Memorable Member

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#])))

Anonymous
Not applicable

Thanks!

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.