Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Designer Desktop Discussions

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

Substraction based on varying number of fields

verast23
7 - Meteor

Hello,

 

thanks for all your helpful contributions so far, I hope you can help me with this issue.

 

Regarding the following table, I have to substract in row 1: Name1, [1] - [2] - [3]. The problem is that the number of fields is varying, so sometimes I can have only field [1] & [2] and the other time there can be 7 fields and each field has to  be substracted from the field [1]. 

Name123
Name 1-50000
Name 230003
Name 3120050
Name 4-120-230-450

 

It would be great if someone could help me.

 

Thank you!

5 REPLIES 5
Emil_Kos
17 - Castor
17 - Castor

Hi @verast23,

 

This is a very simple solution that should work for you.

 

Emil_Kos_0-1611045931205.png

As a first step, I standardised the input so it will always have 7 fields. After that, I used a simple formula tool to make the calculation.

Emil_Kos_1-1611046033916.png

 

verast23
7 - Meteor

Hi Emil,

 

thank you very much for your reply. I think I have expressed myself a little misleadingly. The number of fields is not limited to 7, it can be any number. Only field [1] always exists. So all existing other fields (except of [Name]) should be substracted.

AngelosPachis
16 - Nebula

Hi @verast23 ,

 

I have slightly altered your input to include more columns that may/may not be there. Your input would look like this:

 

AngelosPachis_0-1611046380710.png

 

And what you want to achieve is subtracting all values from column [1], right? If that's the case, the following workflow should work for you:

 

AngelosPachis_1-1611046470516.png

It will essentially aggregate (sum) all fields apart from field [1] to create this new column [Value to Subtract] and then with the formula tool you just make the subtraction.

 

Hope that helps, let me know if that worked for you.

 

Cheers,

 

Angelos

 

 

messi007
15 - Aurora
15 - Aurora

@verast23,

 

Please see below :

 

messi007_0-1611047063033.png

 

Attached the workflow,

Hope that helps !

 

Regards

verast23
7 - Meteor

Thank you very much for your contributions, now it works! 

 

Have a nice day! 

Labels
Top Solution Authors