Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Iterative macro not working

yib122
5 - Atom

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!

3 REPLIES 3
CoG
13 - Pulsar

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?

yib122
5 - Atom

[Sell in] and [Sell Thru] are defined for all weeks.

As for the maximum iteration threshold, how can I set this in the macro?

CoG
13 - Pulsar

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:

Screenshot.png

 

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!

Labels