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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Gerardo_Mora
Regular Visitor

Rolling Inventory Forecast - Monthly data and a started value.

Hi, good morning. Hope you're ok.
I have an issue projecting a variable. 

 

I have a star model in which I have information about inventory, sales and purchases. And I have an initial real value. 

For example. Initial inventory for june is 100, I have sales by 60 and purchases for 30, which means at the end of june I will have 70 units. This 70 units must be the july initial inventory and so on to the future. 
I have already calculated some metrics but I got a circular error which I cannot solve. 

This is my initial formula per month 

Gerardo_Mora_0-1656599717082.png


and my close stock per month 

Gerardo_Mora_1-1656599752484.png

Clearly there's a circular reference, because end of month stock use initial inventory and, for the past I have to display the real of the next month, not the natural close of the metrics. But I don't how to filter, that from one date takes the real and for the rest take the calculated metric and create the reference circular. 
I'm attaching also the model if helps.

Hope you can help me. It's been 5 days since solutions and I have tried all recommendations from internet. 

 

Link model: https://drive.google.com/file/d/149mHMmlyS80B4fVlBxFaXUcpDSaiACeR/view?usp=sharing

1 REPLY 1
daXtreme
Solution Sage
Solution Sage

Hi @Gerardo_Mora 

 

I remember that such problems have already been soleved on this forum. I have addressed several issues like this in the past myself. I'll try to look into your file but can't guarantee it'll be today.

 

I'm just thinking... Would it not be OK to pre-calculate the inventory state at the beginning/end of each month and place the values into a table instead of writing a measure for this? You could do it in the source system or Power Query where it would be rather easy. Have you thought about it?

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

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

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.