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.

Newbie: I'd like to double check if each of the sales transactions are accurately priced

tsao88
7 - Meteor

dataset 1: a list of sales transactions with various parameters including shipping methods, gift wrapped, free samples taken, etc. (the conditions is usually marked with 'X'

Sales record IDShipping methodsGift wrappedFree samples requested
1x  
2xx 
3xx

x

 

dataset 2: official price list :if three of the above conditions are met, it's $10 for the services;
if two of the above conditions are met, it's $8;
if one of the above condition is met, it's $5

Shipping methodsGift wrappedFree samples requestedPackageFee
xxxA$10
xx B$8
x  C$5

Could you please advise on which tools I might use to have Dataset 1 to scan through Dataset 2, scanning from left to right and top to bottom? I would appreciate any guidance you can provide?

 

Desired result

Sales record IDPackageFee
1C$5
2B$8
3A$10
16 REPLIES 16
TUSHAR050392
11 - Bolide

happy to help ! please find my response -

1. You can use the function LEN(Match Key) in a formula tool which will give you the length of match key if it is only made of X. For e.g. XXX will have length of 3.

2. If you have a numeric field, you should convert into a string by either using a select tool or within the formula when you are generating match key, you can use Tostring function for that column to make it string. Your match key formula will look like - Column1 + Column 2 + Tostring(Column3) + Column4.

 

If anyone of your field is numeric, it will give you a syntax error because you are trying to concatenate string with numbers.

 

Hope this is helpful and can be marked as a solution

tsao88
7 - Meteor

(1) If I have more than 10 additional parameters to consider in addition to 'Shipping, Gift Wrapped, Free Samples, Coupon Code, Air mail'. Is there a more efficient way to link the field columns, or I can only do it manually by [Shipping]+[Gift Wrapped]+[Free Samples]+[Coupon Code]+[Air mail]+etc.?

 

(2) When comparing the sales records to my price list, the coupon code could be 12345 or 54321. What's the proper way to establish a formula that would take either one of 12345 or 54321 as input to the 'Match Key' column? In addition, what formula tool could I use to filter-in the last digit in the a coupon code and disregard the first 4 digits? 

 

(3) Any suggestions of formula tool for the application of purchase discount when a proper coupon code was applied, as well as a maximum shipping fees ($10 for continental USA) 

 

Thanks!

TUSHAR050392
11 - Bolide

Hey,

1) I think that should the easiest way or else you can use transpose plus cross tab but that will make it complicated.

2) When you are creating the match key, make sure that you use the same order of columns or else it will lead to mismatch. To get the last digit, just use right(coupon code,1) to get the last digit.

3) I am not sure what the question is here but if you are asking that you want to do some calculations with if there is a coupon code then you can probably use if else statement. For example - IF coupon code = 12345 THEN price*0.9 (10% discount) ELSEIF coupon code = 54321 THEN price*0.8 (20% discount) ELSE price END.

 

Hope this helps

tsao88
7 - Meteor

My match key formula (Column1 + Column 2 + Tostring(Column3) + Column4 + etc) returns 'null' in the new match key column, however I was expecting to see a series of letters and numbers such as Match Key 'XYZ321'..

TUSHAR050392
11 - Bolide

@tsao88 Can you provide a screenshot of the formula and data so that I can look? Only reason it will return null if it has everything blank because for data type issues, formula tool will give a syntax error.

tsao88
7 - Meteor

The formula is straight forward and all in pink/red colors, no signs of syntax errors, however the result returns NULL. 

Although the match key was a bit longer, about 30+ characters consisting of letters and numbers, it didn't match data at all.

 

[Field1] + [Field2] + (Field3] + [Field4] + [Field5] .... Field 40]

 

Capture6.PNG

 

I've also tried TOSTRING([Field1] + [Field2] + (Field3] + [Field4] + [Field5] .... Field 40]), it returns NULL as well

TUSHAR050392
11 - Bolide

@tsao88 For matching, you need to ensure that your fields are in the same order on both sides otherwise, they won't match. For the null values, please use a select tool before the formula tool and check if all fields are string data type. Can you also share a screenshot of select tool showing all your fields if possible?

Labels
Top Solution Authors