Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

CurrentFieldName and IF ELSE statement with calculations added in Multi - field formula

Justyna
7 - Meteor

Hi All:)

 

There are 50 columns in my data (A,B,C.......ZY) and then each one has to be multiply by 1 of another 50 column with different coefficient (A_M, B_M, C_M.....ZY_M).

 

I know I can do this easily using Formula and creating one new column with multiplication at the time , but I bet there is a better way:)

 

I just wonder if something like this is possible with Alteryx with Multi - field formula action on multiple column at the same time.

 

IF [_CurrentFieldName_]==[A] THEN ([A]*[A_M])
ELSEIF [_CurrentFieldName_]==[B] THEN ([B]*[B_M])
ELSE [_CurrentFieldName_]==[D] THEN ([D]*[D_M])    etc. for each of 50 columns .....
ENDIF

 

Thanks!:)

4 REPLIES 4
BenMoss
ACE Emeritus
ACE Emeritus

Hey Justyna,

 

I'm not sure if this is possible using the multi-field formula tool, but I have created a workflow that allows you to produce your desired result without writing all the calculations.

 

It may need amending slightly for your specific use case mind :)

 

See attached.

 

Ben

patrick_digan
17 - Castor
17 - Castor

I liked @BenMoss method. I think the Dynamic Replace can also be used, so I thought I would post it here as well. The dynamic replace is very under used so I'm trying to see what kinds of problems it can solve.

SeanAdams
17 - Castor
17 - Castor

I did something similar to @BenMoss - but instead of using field names, split the data by field position and then rejoined it back together (columns in the first half join with columns in the second half).

 

Very much enjoyed @patrick_digan solution - I've seen these tools lurking in the toolbox, but never had a good excuse to use most of them - so this is a great example to learn from.

 

@JustinJ- if @BenMoss or @patrick_digan 's solutions solved your problem, would you mind marking this as solved?   If you still have questions - feel free to post them back on this thread (possibly with some of the data you're working with so that we can post a solution that exactly meets your needs).

 

Cheers 

Sean

Justyna
7 - Meteor

Thank you very much! :) 

I wouldn't find this solution myself.

I will  take a look when solve another issues with my workflow....

 

 

Labels