Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Fractions to a Decimal

Tommy1
5 - Atom

Hello,

 

I have both decimal values and Fraction values within a "Nominal Size"  field.

 

How do I convert the all the fractions within the field to decimals  so I can set the field as a Double Variable? Simply 3/4 to 0.75

 

Thank you,

 

Tommy

5 REPLIES 5
ImadZidan
12 - Quasar

Hello @Tommy1 ,

 

Alteryx can do it for you. Is there a specific scenario you have .

 

Check attached.

PhilipMannering
16 - Nebula
16 - Nebula

You could split the number by forward slash using Text-to-Columns > then convert the numbers to integers > then calculate the quotient in a formula tool.

 

Example attached,

PhilipMannering_0-1598007930292.png

 

Tommy1
5 - Atom

Worked a treat! thank you for the quick response.

 

I also had some "#N/A" and "N/A" data within that column which I'll remove with a formula.

 

However, How do I now merge the newly created "decimal" field and the original "nominal size" field.

 

Basic question, I only started Alteryx yesterday  

 

Thank you

 

 

 

Tommy1
5 - Atom

I think I figured out my own question. To merge the data so the fractions are converted to decimals within the same field. I used the If statement:

 

IF Contains([1st End Nom. Thread Size], '/') THEN

tonumber([fraction1]) / tonumber([fraction2])

ELSE [1st End Nom. Thread Size]

ENDIF   

ImadZidan
12 - Quasar

Well done.

 

Its only the beginning. It get better 🙂 

Labels
Top Solution Authors