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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

Cyclic reference when calculating a Stock using its previous day result

Hello,

 

I have a problem with a cyclic reference  trying to calculate the stock of a final inspection process.
Calculated Stock.png

 

 

 




*Day stock is the result of Production - Scrap - Wharehouse entry + Initial Stock
*If an inventory is loaded, that day Initial Stock = Inventory. If not, Previous day stock is needed

 

That leads to a cyclic reference I can't avoid.
Day Stock =Production - Scrap - Wharehouse entry + Previous day (Production - Scrap - Wharehouse entry + Previous second day (Production - Scrap - Wharehouse entry + Previous third day ... and so on)

How can I solve it?

Here is some sample data,

.PBI and Excel 

 

Thanks.

Ramiro Diz

2 REPLIES 2
dax
Community Support
Community Support

Hi RamiroDiz, 

I think it is hard to calculate cycle reference in DAX. You need to create many measures for the previous day's value and the meausre will be beased on context, so it is hrad to get previous day's value(I complete a part of this). You might need to achieve this in other tools, then use this in PowerBI. Or you could try to ask other super users in forum for help.

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi,

It's not posible to create infinite measures to get the value im wishing because I don't know how many days will pass since the last inventory.
Thats why I'm trying to generate a calculated column that brings the previous Day Stock if Inventory is empty. But I'm not able to get what I need.

Thanks for the answer,
Ramiro

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.