This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
Fun problem... Again no macros - but I did cheat and use Alteryx to generate a super long expression for a multi-field formula for part 1. Without adding the recordID I needed for Part2, part1 has a (cheater) golf score of 3. Part2 looks like almost exactly the same solution as @jdunkerley79
Non-macro part 1 and iterative part 2. Runs in 4.4 seconds non-Amped and errors in Amp and 3.4 in Amp.
The first time I tried it in Amp, the logic in my macro failed because it implicitly assumed that the records in the iterative input wouldn't change order between iterations. It's technically not between iterations, but in the tools that prepare the records to be sent out the iterative output. The solution was to add a Sort tool before the multi-row.
Part 1 does an X join to get all the sums and joins the sum to the target then removes the records where the inputs are outside of the look back range. Used a text input to modify the look back range as opposed to @jdunkerley79 workflow constant Part 2 uses an iterative macro with a multirow to generate a running total starting from Engine.Iterationnumber +1 and ending when the total >= target
Definitely not winning on tool golf, but my speed is on point. Or on fleek as my 18 year old niece tells me I should be saying.
Still going with no macros
Top flow generates all possibilities of number sums that could be used. Middle flow generates just the ones that will be used. These are joined together. Any set of numbers that doesn't find a match is output.
Second part took a bit more thought. Didn't want to generate all combos of numbers, so tried out different looks at the running total. Turns out that subtracting the number from the running total gets you the segment of comparison.
Loads of generate rows tools got the job done. Would be lovely to feed a measure into the sample tool, which was more performant for me than filters,, to make this totally dynamic.