I am trying to run this iterative macro but it only works for the first two rows and stops after that.
The calculation for Ending Inv = [Beginning Inv] + [Sell In] - [Sell Thru]
I am using a Multi-Row Formula tool to update Beginning Inv with the formula:
IF [Week] > [Plan ID] THEN [Row-1:Ending Inv] ELSE [Beginning Inv] ENDIF
The Beginning Inv should pull the value of Ending Inv from the previous week and Ending Inv value should be recalculated using this Beginning Inv value.
I would like to run this from week 202440 to week 202452 as Plan ID is set to 202439.
If there's a way to resolve this, I would appreciate the help.
Thanks!
Solved! Go to Solution.
First, your iterative macro does not have an off ramp, and will run until it hits the maximum iteration threshold (This is not recommended). Also, are [Sell in] and [Sell Thru] defined for all weeks or do they also need to be calculated somehow?
[Sell in] and [Sell Thru] are defined for all weeks.
As for the maximum iteration threshold, how can I set this in the macro?
There was actually a weekly challenge that this reminds me of: Challenge #432: Sequential Logic - Alteryx Community
Ultimately, you don't actually need an iterative macro for this problem. The following is a simple way to solve this problem:
The Multi-Row Formula Tool is the MVP for this solution Allowing you to reference prior rows Ending Inv.
Hope this helps and Happy Solving!