cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lulcasl
Frequent Visitor

How to calculate Moving Average as forecast method?

I'm work with the following data:

lulcasl_1-1612795095857.png

 

The measure [Volume Realizado] brings me the total transported each day, working as it should. As the table show, it can be divided between [Meso], [Semana], [Material] and [Tipo]. Now here's the issue, I want to use the average of the last 7 days for a rolling average and I want it to keep going even after days which I don't have values (07/02 and so on), here's the expected result:


lulcasl_2-1612795136472.png

 

I want the measure to drill down with each context just like the SUM, so if I want to see the measure only on the [Meso] context it'll give me on value, but I want to be able to drill it even more with [Material] for example.

Here's the .pbix.
EDITED

 

Thanks in advance!




 

3 REPLIES 3
AUaero
Responsive Resident
Responsive Resident

I'm not sure Power BI is built for this but I'd be happy to be wrong.  What I'm trying to do is recreate the same type of recursive capabilities that you can do in Excel where each successive value builds on the value of the one before.  Since DAX isn't recursive I don't see how that is possible.

AUaero_0-1639083053995.png

 

smpa01
Super User
Super User

@lulcasl  Power BI is built to deal with this sort of scenario. Please provide sample data and expected output.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






New Animated Dashboard: Sales Calendar


AUaero
Responsive Resident
Responsive Resident

I've been struggling with this as well.  Power BI doesn't support recursive calculations with DAX, so you can't do it the same way you'd calculate a forward looking moving average in Excel.  I'm experimenting with Python scripts to try to solve this now.

Helpful resources

Announcements
Join Arun Ulag at MPPC23

Join Arun Ulag at MPPC23

Get a sneak peek into this year's Power Platform Conference Keynote.

PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Top Solution Authors
Top Kudoed Authors