Forum Discussion

bourne2000's avatar
bourne2000
Icon for Helper V rankHelper V
5 years ago
Solved

Getting error in calculating Moving average (Rolling average sale)

Hi 

 

I am trying to calculate the Rolling sales but not successful. I am getting the wrong value. 

 

My data has billing(date column), Sales. It starts from 1st July 2019 to 1st June 2021. Monthly sales data

 

I tried the below DAX measures but both of them giving the wrong values

 

Rolling Average = CALCULATE(
AVERAGEX(ALLSELECTED(Data), Data[Revenue]),
FILTER(ALLSELECTED(Data),
Data[BILLING] <= MAX(Data[BILLING]))
)
 
Rolling Average 1 = CALCULATE(AVERAGE(Data[Revenue]), DATESINPERIOD('Data'[BILLING], LASTDATE('Data'[BILLING]), -3, MONTH))

 

 

 

 

The rolling average for 1st July 2019 should be the same value of sales value (291,263) but it gives 72,815. Can you please advise what's wrong here?

 

My pbix attached https://we.tl/t-7hzrZWpNQk