Quantcast
Viewing all articles
Browse latest Browse all 17899

Calculating moving average

Hi,

 

I'm trying to calculate the moving average over the past year for every month. I have formed a table with 4 columns:

Jaarmaand = year+"-"+month

Aantal oorzaken = count of a certain event (this is the column I want the moving average over)

Datum = Date(left(jaarmaand;4);right(jaarmaand;2);1) (this is the first day of every month calculated for sake of the next column)

Moving average =
                               CALCULATE(
                                      AVERAGE('Summarize aantal oorzaken'[Aantal oorzaken]);
                                      DATESINPERIOD(
                                                   'Summarize aantal oorzaken'[Datum];
                                                    LASTDATE('Summarize aantal oorzaken'[Datum]);
                                                    -12;
                                                   MONTH
                                                               )
                                                   )

 

The problem is that the Moving average column only displays the value for that date, not the moving average. The aim is to average the left selected cells into the right selected cell. Any help is greatly appreciated!

 

Image may be NSFW.
Clik here to view.
Moving average.png


Viewing all articles
Browse latest Browse all 17899

Trending Articles



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