cancel
Showing results for
Did you mean:

# Alteryx designer Discussions

## Alteryx Build a Loop to See lowest value and limit SUM TOTAL - MACRO

Highlighted
Atom

I believe a macro is needed to solve the problem below.

I have the following raw table data

The formula for coverage in Months is =INT((inventory+SUM(march:may))/monthly forecast requirement)

 Item Inventory Monthly forecast requirement Coverage in months Mar-19 Apr-19 May-19 186745230S 16 17 25 186745235 300 22 19 186745240S 60 27 12 186745245 150 18 15 186745250 9 10 8 Total 0 0 0

In Alteryx I need some help designing a kind of loop to solve this problem.

The loop would read the complete Column - "Coverage in months" and then pick the first lowest Number it sees. In the example above it would be Row 1 which reads 0. Then the loop should "+1" in the column Mar-19 for that particular Item.

Looking again for the formula for Monthly forecast requirement, we can see that even after pasting "1", the coverage in Months will still be 0 for this particular item.

So the loop runs again and looks again at the lowest value in the Coverage column and increase quantity by "1".

Another condition is the Total sum at the end of each month would be 1000.

After running the loop for Mar 19 then the loop would jump to the next column April 19

The output should look something like this. The results below are fake numbers

 Inventory Monthly forecast requirement Coverage in months Mar-19 Apr - 19 186745230S 16 17 5 100 200 186745235 300 22 18 100 100 186745240S 60 27 6 200 100 186745245 150 18 15 350 250 186745250 9 10 5 250 350 Total 1000 1000

An example excel sheet is attached

Bolide

Hi there,

I think I was able to do what you accomplished in an iterative macro. Take a look and tell me if you meant something different.. even if you did, this should give you a good start.

Best,

mmenth

Labels