Forum Discussion
WePowerBI
6 years agoNew Member
Moving average in 5 day intervals
Hi I want to figure out a moving average of sales in 5 day intervals. want to show the average of sales in the last 5 days for each day. I would then like to use this value in a line chart. Can anyo...
v-lid-msft
Community Support
6 years agoHi WePowerBI ,
We can use the following measure to meet your requirement:
Measure =
CALCULATE (
AVERAGE ( 'Table'[value] ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[Date] <= MAX ( 'Table'[Date] )
&& 'Table'[Date]
> MAX ( 'Table'[Date] ) - 5
)
)
Then we can get the result like this,
If it doesn’t meet your requirement, could you please show the exact expected result based on the table that we have shared?
BTW, pbix as attached.
Best regards,
WePowerBI
6 years agoNew Member
This is what I want to accomplish in Power BI. In my Power BI dataset, I have a date table and a sales table that has a date table associated with the date table. How can I achieve the same thing in Power BI?
- v-lid-msft6 years ago
Community Support
Hi WePowerBI ,
How about the result after you follow the suggestions mentioned in my original post? Please try to unpivot the date column in power query editor if your date is multi columns.
Best regards,