Alert: There is a planned Community maintenance outage October 16th from approximately 10 - 11 PM PST. During this time the Alteryx Community will be inaccessible. Thank you for your understanding!

Alteryx Designer Desktop Discussions

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

Creating new column/tag based on value

michael2529
5 - Atom

I have a data set that has a running total column. I want to assign the top 80% as "Fast", between 80%-90% as "Medium" and the bottom 10% as Slow. 

 

When I do an If statement, I can't get past the middle section of the formula for the range of percentages. 

 

IF [RunTot_% of dmd] < "80.01" THEN "F"
ELSEIF [RunTot_% of dmd] < "80" AND [RunTot_% of dmd] > "90" THEN "M"
ELSE "S"
ENDIF

 

Any insights?

4 REPLIES 4
atcodedog05
22 - Nova
22 - Nova

Hi @michael2529 

 

Is the datatype of [RunTot_% of dmd] double or string ? If its double (number) then it should be

 

IF [RunTot_% of dmd] < 80.01 THEN "F"
ELSEIF [RunTot_% of dmd] < 80 AND [RunTot_% of dmd] > 90 THEN "M"
ELSE "S"
ENDIF

 

If you provide some sample data or snapshot of error we can help you.

Kenda
16 - Nebula
16 - Nebula

Hi @michael2529 

 

Is your [RunTot_% of dmd] field a numeric field? To check values based on this field, you will likely want it to be numeric. Then, in that case, you will not need quotation marks around the numbers in your if statement. 

 

 

Also, it looks like you're checking if the value is less than 80 and greater than 90. A number cannot be both of these, so maybe you wanted to say greater than 80 and less than 90?

 

Hope this helps!

atcodedog05
22 - Nova
22 - Nova

@Kenda wrote:

Hi @michael2529 

 

Also, it looks like you're checking if the value is less than 80 and greater than 90. A number cannot be both of these, so maybe you wanted to say greater than 80 and less than 90?

 


 

@Kenda has made a great point. You might need to change the condition like below.

 

IF [RunTot_% of dmd] < "80.01" THEN "F"
ELSEIF [RunTot_% of dmd] > "80" AND [RunTot_% of dmd] < "90" THEN "M"
ELSE "S"
ENDIF

michael2529
5 - Atom

Thank you! I forgot to change the formula output to a double so now it worked!

Labels