Quantcast
Channel: All Developer posts
Viewing all articles
Browse latest Browse all 49324

Re: Calculating moving average

$
0
0

Hi,  For me, this works:

 

Assuming a table with columns Date and Amount, the calculated column below does the job :

Amount MAVG =

var sdate=Min(Amounts[Date])+365

var d = 'Amounts'[Date]
var d365 =d-365

var r=
IF(d>=sdate;
 SUMX(  FILTER('Amounts';  Amounts[Date] <= d  && Amounts[Date] > d365);
  [Amount]   )
 /12
)
RETURN
r


Viewing all articles
Browse latest Browse all 49324

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>