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

Percentage calculation and Trimleft formula

Kshen
7 - Meteor

I have two issues as the following

 

1. I have used the formula below to calculate tax percentage. (Data Type: V_WString, Size 4). However, the result is inconsistent. As you can see from the screen shot below, row 10 and row 11 both did the calculation, but in a inconsistent format. I'd like something to show as either 7.74% or 0.0774. Either format will be fine, but I'd like to have consistency across the file. 

 

[Sales Tax Amt]/[Sum_Line Item Amount]

Kshen_1-1633653710608.png

 

 

Kshen_0-1633653468670.png

 

2. In Customer column below, I'd like to move the leading zeros. I used formula below to Trimleft, but I received an error message that I am not sure how to fix. 

 

Kshen_2-1633653855301.png

 

Kshen_4-1633653896152.png

Kshen_5-1633653920246.png

 

Any help will be appreciated. Thank you!!

 

 

 

7 REPLIES 7
Luke_C
17 - Castor
17 - Castor

Hi @Kshen 

 

For the first item, is there a reason you're using a string datatype? Try making it a double to rule out any quirks around data types.

 

For the second, you need to give the new field you're calculating a name. In the top left of the formula screenshot you can do this where it says "select a column "

PhilipMannering
16 - Nebula
16 - Nebula

Hey @Kshen. Are you able to share the bit of the workflow you're struggling with? That first one is very odd. I suggest you output to a numerical field type (float, double or fixed decimal). And your formula is correct in the second one. Perhaps you have an extra empty calculation that's throwing an error. 

 

As I say, can certainly help if you share the workflow.

Kshen
7 - Meteor

Thank you all for the prompt response! For #1 above, I changed to double and it resolved the problem. The only question I have left is how can I limit number of digit after decimal points? Currently, Alteryx rounded the number into the nearest 6 decimal points. I'd like to change it to 3. See screen shots below

 

For #2 above, once I added a new column and trim left, it worked! 

 

Kshen_0-1633672793140.png

 

Kshen
7 - Meteor

Thank you for the prompt response! For #1 above, I changed to double and it resolved the problem. The only question I have left is how can I limit number of digit after decimal points? Currently, Alteryx rounded the number into the nearest 6 decimal points. I'd like to change it to 3. See screen shots below

 

For #2 above, once I added a new column and trim left, it worked! 

 

Kshen_0-1633672793140.png

 

Kshen
7 - Meteor

Hi @PhilipMannering, Thank you for your response! 

 

I changed data type to Double and it worked for item #1. 

 

For item #2, unsure if there is any other way, but I created one new role for the Trimleft, it worked! Now the workflow is showing as below

 

Kshen_1-1633673270872.png

 

 

 

 

binuacs
21 - Polaris

Round([Sales Tax Amt]/[Sum_Line Item Amount].0.001)

Kshen
7 - Meteor

Thank you!!

Labels
Top Solution Authors