Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Can Macro be applied to Multi-Row Tool to produce same calculations for different fields?

jwamendoza
6 - Meteoroid

Dear Alteryx Experts, 

 

I need your help. I'm using a multi-row formula tool to produce 3 different calculations (based on previous row values) from field name A.

Now, using the same calculation, I need to produce exactly the same results for different fields, i.e. "B" and "C".

 

jwamendoza_0-1660116237845.png

 

Is there a way to apply macro on this matter instead of replicating  the calculation step for "B" and "C" into separate workflows/steps?

 

Expected Output is like this.

 

IDTimeABCA_Prev1A_SumPrev2A_AvePrev2B_Prev1B_SumPrev2B_AvePrev2C_Prev1C_SumPrev2C_AvePrev2
XYZM1123456000000000
XYZM2101907812126343417565628
XYZM312314516710111356.590124627813467

 

 

I'm attaching a dummy file for your reference.

 

I hope someone has a solution to this.

 

Thank you.

 

4 REPLIES 4
kathleenmonks
Alteryx Alumni (Retired)

Hi @jwamendoza 

 

Instead of using a macro, you can transpose your data, run the calculations and then crosstab your data back. Attached is your workflow showing how this would be done. Some sorting is needed to ensure the calculations happen as you would expect and I added a formula tool to create the column headers before the crosstab. If there are only 3 columns (A,B,C) this might not be the most elegant solution, but if you have more and more columns, this scales more effectively than copy/pasting three multi row formulas per column. 

 

Let me know if this helps!

flying008
15 - Aurora

Hi, @jwamendoza 

 

First, there is a resolution with Multi-Field & Multi-Rows macro in gallery. (All field names and order can be output automation as you want.)

 

录制_2022_08_11_16_58_47_269.gif

 

 

****************************

The second, you can use the way like @kathleenmonks  to get the result, all are auto like above macro output.  Don't worry even if you have more columns to be process.

 

录制_2022_08_11_16_59_56_37.gif

jwamendoza
6 - Meteoroid

Thank you @kathleenmonks and @flying008 for sharing your solutions. :)

flying008
15 - Aurora

Hi, @jwamendoza 

 

Please mark this as the solution if it answers your question, it will help others to find solutions quicker.

Labels
Top Solution Authors