Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Moving average for values with gap in dates.

Hi! First time posting here and only started last week so do help 🙂 I have a table with values such as this

DatesCountriesValues
28.02.20Iran4
28.02.20Iran2
24.02.20China6
23.02.20Iran7
21.02.20China4
19.02.20Iran3
17.02.20China2

 

I need a line chart that depicts 3 moving averages, 7, 20 and 30 days.

 

So far,

I have tried the formula,

CALCULATE(AVERAGEX(Query, Query[Values]), DATESINPERIOD('Calendar'[Date].[Date],LASTDATE('Calendar'[Date].[Date]), -7,DAY),
with calander[date] as my axis while creating a bidirectional relationship between my calendar table and dates,
Then filtering the countries on the line chart by visual filters but the values are wrong.
 
Please do help 🙂
 
Please do help

2 Replies