alteryx Community

# Weekly Challenges

Solve the challenge, share your solution and summit the ranks of our Community!

Also available in | Français | Português | Español | 日本語
###### IDEAS WANTED

Want to get involved? We're always looking for ideas and content for Weekly Challenges.

## Challenge #374: Using Iterative Macros

Alteryx

A solution to last week's challenge can be found here.

Challenge #74: Build a Factorial Calculator was published way back in June 2017. It pushed Alteryx designers to make a macro to calculate factorials. A worthy goal, to be sure.

It is time to dust off an old classic and ramp up the difficulty a bit.

My manager, Sydney, is obsessed with iterative macros and wants to see if I can use them properly. Sydney loves clean workflows, so there may be no other tools on the workflow canvas other than a single input, the macro, and a single output. And finally, my manager is entertained by simple things. Sydney likes the idea of the macro spinning around and around, calculating the factorials one multiplication problem at a time. So, the iterative macro must conduct a single multiplication per input number on each pass.

Are you up to this new challenge?

Here are the original challenge requirements to refresh your memory on factorial calculations:

Factorials are commonly used to calculate the multitude of ways a task can be completedsuch as how many possible results could come from shuffling 52 playing cards.

Factorials are usually represented by ‘n!’n being an integer. If we were looking for the factorial of 4, it would be represented as 4!. To calculate the factorial of 4, the equation is written as (4)*(3)*(2)*(1). The following are some example calculations:

1! = (1) = 1

2! = (2)*(1) = 2

3! = (3)*(2)*(1) = 6

4! = (4)*(3)*(2)*(1) = 24

New Challenge Requirements:

1. You must use an iterative macro.
2. You must conduct only one multiplication step on each input row, on each iteration.
3. The workflow must consist only of: Text Input - Macro - Output

8 - Asteroid

I'm still struggeling with macros. I needed to add an empty  "output" column to the input. I didn't figure out how to do it otherwise. I'm looking forward to the other solutions.

Spoiler

11 - Bolide
Spoiler

20 - Arcturus
Spoiler

16 - Nebula
Spoiler

Alteryx

That's a fun way to start a Monday!

Spoiler

11 - Bolide

Modified my text input to do what I needed.

Spoiler

8 - Asteroid

Fun!! and a great way to start a Monday :D

Spoiler
Got stuck on the "circular reference" of initializing the Factorial field and calling it at the same time in a formula tool... finally clicked that I could initialize it in a Text Input in the macro :P

9 - Comet
Spoiler

ACE Emeritus

Here's mine - I did add a field to the text Input so I could keep accumulating the total between iterations while still keeping the label of the original number.

Spoiler