We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Total amount using the saved expression

naveen_kr
5 - Atom

I have two excel files. I have done a left join in Alteryx for these two files using Dealer group no. and Client code. I want create a flow in Alteryx where if NAT is Selected it will calculate the total amount using expression saved in the second excel file's "Amount" field. for example for Dealer group no. 10000 the total amount will be [A_Tax+B_Tax+C_Tax+D_Tax] i.e. 1400 and for Dealer group no. 10100 the total amount will be [A_Tax+B_Tax+C_Tax] i.e. 900. and so on. I want to use a formula tool and add a new column "Total Amount" where it uses the expression saved in the second excel files to add the Total Amount. Using a batch macro is also fine. Please help me with this.

 

Client CodeDealer Group no.A_TaxB_TaxC_TaxD_Tax
NAT10000200300400500
NAT10100200300400 
EFR20000200300400500
EFR20100300400600700

 

 

Client CodeDealer Group no.ACICAmount
NAT10000NoA_Tax+B_Tax+C_Tax+D_Tax
NAT10100YesA_Tax+B_Tax+C_Tax
EFR20000NoA_Tax+B_Tax+C_Tax+D_Tax
EFR20100NoA_Tax+B_Tax+C_Tax+D_Tax
7 REPLIES 7
Deano478
12 - Quasar

@naveen_kr if a user is going to have to select the Client Code then you will need to go down the route of an analytic app using the interface tools for user input if you have no looked at analytic apps before here is a starting point.

 

Creating Analytic Apps 

 

kylecoleman
6 - Meteoroid

Rather than subbing in the contents of the "Amount" cell as a formula expression, you could use it to inclusively add the tax values if the code is present in the string.

 

ToNumber(
IF Contains([Amount],"A_Tax")
THEN [A_Tax] ELSE 0 ENDIF +
IF Contains([Amount],"B_Tax")
THEN [B_Tax] ELSE 0 ENDIF +
IF Contains([Amount],"C_Tax")
THEN [C_Tax] ELSE 0 ENDIF +
IF Contains([Amount],"D_Tax")
THEN [D_Tax] ELSE 0 ENDIF
)

naveen_kr
5 - Atom

this will not help as i have multiple client codes and multiple conditions. There should be some kind of tool where it will pass the saved expression to the formula tool.

naveen_kr
5 - Atom

I am using the analytical app for selecting the client code. I need the solution for the above problem. I have multiple client codes and multiple conditions. We must pass the saved expression in the Amount field to a formula tool so that it can calculate the total amount.

kylecoleman
6 - Meteoroid

If you were already planning on joining the two tables and using a cell to hold the formula for each client scenario, the formula I suggested would work without any extra effort.

OllieClarke
15 - Aurora
15 - Aurora

Hi @naveen_kr 

 

not 100% sure I follow you, but the dynamic replace tool might be what you're after here:

image.png

 

This lets you update 1 (or more fields) based off written out formulae without needing to use batch macros

There's more info here: https://help.alteryx.com/current/en/designer/tools/developer/dynamic-replace-tool.html

Hope that helps,

 

Ollie

abacon
12 - Quasar

I believe I was able to do this without a batch macro. I haven't added analytic app functionality but it sounds like that part you have figured out.

Labels
Top Solution Authors