Alteryx Designer Desktop Discussions

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

Need help to replicate logic in alteryx

AhanaR
7 - Meteor

Hi team,

 

Need Support

 

Could someone please help replicate this logic in alteryx

 

If Document currency = "USD" then (Backlog Value in Document Currency), elseif document currency <> "USD" then (Backlog Value in Document Currency */ plan rates). Additionaly I want to add a logic that will multiply document currency with plan rate if the field market convention ="Multiply", else divide if the filed says "Divide"

7 REPLIES 7
AhanaR
7 - Meteor

My datasets are as below :

 

Sales Document NumberBacklog Value in Document CurrencyDocument Currency
123697.5USD
2351694.4USD
23676300USD
6799347USD
1562420.35AFN
250900.54DZD
2511950.6GBP
97417735.95EUR
35944460FKP

 

Dataset 2:

Currency CodeCurrency NameMarket ConventionPlan rates
AFNAfghanistan AfghaniDivide87.49
DZDAlgerian DinarDivide136.702
AOAAngolan KwanzaDivide502
ARSArgentine PesoDivide173.91
AMDArmenian DramDivide390.3
AUDAustralian DollarMultiply0.6696
AZNAzerbaijan ManatDivide1.695
BHDBahraini DinarDivide0.37697
BDTBangladesh TakaDivide105.52
ShankerV
17 - Castor

Hi @AhanaR 

 

Can you please share the expected output also.

AhanaR
7 - Meteor

Hi Shanker, 

 

Thanks for your reply.

 

Here is the updated dataset with expected output in col named "Converted document Currency 

 

Sales Document NumberBacklog Value in Document CurrencyDocument Currency Converted Document Currency 
123697.5USD                                             697.50
2351694.4USD                                         1,694.40
23676300USD                                         6,300.00
6799347USD                                         9,347.00
1562420.35AFN                                                27.66
250900.54DZD                                                   6.59
2511950.6GBP                                         2,365.69
97417735.95EUR                                      18,853.31
35944460FKP                                      54,045.58

 

Updated Dataset 2:

Currency CodeCurrency NameMarket ConventionPlan rates
AFNAfghanistan AfghaniDivide87.49
DZDAlgerian DinarDivide136.702
AOAAngolan KwanzaDivide502
ARSArgentine PesoDivide173.91
AMDArmenian DramDivide390.3
AUDAustralian DollarMultiply0.6696
AZNAzerbaijan ManatDivide1.695
BHDBahraini DinarDivide0.37697
BDTBangladesh TakaDivide105.52
GBPBritish PoundMultiply1.2128
EUREUROMultiply1.063
FKPFalkland Islands PoundMultiply1.2156
ShankerV
17 - Castor

Hi @AhanaR 

 

One way of doing this,

 

ShankerV_0-1677582391570.png

 

Many thanks

Shanker V

 

ShankerV
17 - Castor

Hi @AhanaR 

 

Step 1: Input Dataset 1

 

ShankerV_0-1677582444979.png

 

 

Step 2: Input dataset2

ShankerV_1-1677582466452.png

 

Step 3: Record Id tool

 

ShankerV_2-1677582487647.png

 

 

Many thanks

Shanker V

ShankerV
17 - Castor

Hi @AhanaR 

 

Step 4: Join tool

 

ShankerV_0-1677582528258.png

 

ShankerV_1-1677582534072.png

 

Step 5; 

 

ShankerV_2-1677582555456.png

 

ShankerV_3-1677582561700.png

 

 

Step 6: Sort tool

 

ShankerV_4-1677582572443.png

 

ShankerV_5-1677582577976.png

 

 

Step 7: 

 

ShankerV_6-1677582605886.png

 

ShankerV_7-1677582611273.png

 

 

IF [Document Currency]="USD"
THEN [Backlog Value in Document Currency]
ELSEIF [Market Convention]="Divide"
THEN [Backlog Value in Document Currency]/[Plan rates]
ELSE [Backlog Value in Document Currency]*[Plan rates]
ENDIF

 

Post run: Output

ShankerV_0-1677582675758.png

 

Many thanks

Shanker V

 

 

Martyn
9 - Comet

You could always use a Find Replace tool with append fields (instead of the Record ID, Join, Union and Sort) to do the Left Join and maintain the record order. The formula tool is still needed for the calculation though.

Martyn_0-1677585514585.png

 

Labels