Forum Discussion

OKgo's avatar
OKgo
Icon for Helper IV rankHelper IV
8 years ago
Solved

Moving average with respect to multple variables

I would like to add a column to this table that captures moving average with multiple variables. Once imported to powerbi, the date format is automatically detected/converted.

 

 

In Excel I was previously using a pivot table and an AVERAGE formula pointing at the correct cells. Tips how I could elegantly do this in DAX would be appreaciated.

7 Replies

  • davehus's avatar
    davehus
    Icon for Memorable Member rankMemorable Member

    My understand of moving average within Powerbi is that you need a date table and from there you could use the DATESINPERIOD function to get the MA over the disired time frame. I'm not sure if it will allow it where there is just a month value in place.

    • OKgo's avatar
      OKgo
      Icon for Helper IV rankHelper IV

      Hi Ashishi

       

      That is really impressive. I opend up the developer section within Excel and can see the VBA objects you created. I was hoping that within PowerBi I could use the 'add column' feature and have something a DAX statement in that extra column. Reason being although I personally have Excel 2013 the clients that I am working with do not.  I am deploying the data via a PowerBi web-app. Would there be a way I could convert your exceptional solution to a PowerBi 'add column' sort of solution? 

       

      Thank you so much!

      • Ashish_Mathur's avatar
        Ashish_Mathur
        Icon for Super User rankSuper User

        Hi OKgo,

         

        You are mistaken.  There is no VBA in there.  Mine's an out and out DAX solution.