Alteryx Designer Desktop Discussions

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

Multiply tables together dynamically

Casual
5 - Atom

I have two tables e.g.

 

Table1

Record ID0 Days7 Days14 Days21 Days
110203040
250607080
390100110120

 

Table2

2021_03_232021_03_302021_04_062021_04_13
0.9990.9870.9760.854

 

I need to to multiply each value in table 1 (excluding column Record ID) by a corresponding amount in table 2. I.e. I'd ultimately like to end up with a table that looks like the below

 

Record ID2021_03_232021_03_302021_04_062021_04_13
1=10* 0.999=20*0.987=30*0.976=40*0.854
2=50*0.999=60*0.987=70*0.976=80*0.854
3=90*0.999=100*0.987=110*0.976=120*0.854

 

The number of dated columns in table 2 will always precisely match the number of value columns in table 1 (i.e. 0days, 7days etc) however the column headers in table 2 will change in every run so it would be hugely helpful if the columns could be multiplied together dynamically based on position. Though if worse comes to worst it is possible to edit the source data ahead of input so the headers match.

 

Apologies not to attach an attempt at a solution but after numerous attempts with 'append'ing the tables together and using a 'multi field formula' tool I haven't come close to a successful solution.

Thanks in advance for any help you can provide!

 

3 REPLIES 3
AngelosPachis
16 - Nebula

Hi @Casual ,

 

What I tried in this occasion is transposing both streams so I bring them in a thin and long format. Then I parsed out the days number from both streams and used that to Join on.

 

Then it was just a matter of bringing the data to the original structure.

AngelosPachis_0-1616526487403.png

Hope that helps, let me know if that worked for you or you have any questions on the workflow.

 

Cheers,

 

Angelos

patrick_digan
17 - Castor
17 - Castor

@Casual In case you wanted to try a macro approach, I have a multi-field multi-row formula macro that would work in a case like this:

 

patrick_digan_0-1616527245473.png

 

I'm currently assuming you'll always have 4 columns, but you could easily make that a formula so it's more dynamic:

patrick_digan_1-1616527290527.png

 

 

 

 

Casual
5 - Atom

Thank you, this worked perfectly! Will certainly be adding the transpose cross tab method for matrix multiplication to the tool box.

 

I slightly adjusted it so I was joining on the named days (0 days, 7 days, ... etc) instead of using the date reference just so it could be re-run for historic periods without needing to convert these into date formats using dateToday().

 

Thanks again!

Labels