Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
OKgo
Helper IV
Helper IV

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.

 

Photo 1.PNG

 

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.
Photo 3.pngPhoto 2.png

1 ACCEPTED SOLUTION

Hi @OKgo,

 

Download the PowerBI desktop file from here.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

7 REPLIES 7
Ashish_Mathur
Super User
Super User

Hi @OKgo,

 

You may refer to my solution here.

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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!

Hi @OKgo,

 

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


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Dear Ashish,


OK I don't have PowerPivot. I will work on getting a licence in the coming days.


Can you please paste the DAX code here? I am hoping to open PowerBi. Add Custom Column. Paste / edit the DAX code. And have that helper column as per your solution in my data set.

 

Thank you so much. I am really looking forward to learning DAX! I suppose I have to start somewhere.

Hi @OKgo,

 

If my reply helped, please mark it as Answer.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @OKgo,

 

Download the PowerBI desktop file from here.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
davehus
Memorable Member
Memorable 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.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors