Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Conversion between units

3p_khr
6 - Meteoroid

Hi. I am working on a project where i need to do calculations based on physical length measurements. The data i get can consist of three different measurement units (meters, feet, and inches), and there is an arbitrary amount of measurements. The format is

[measurement1][unitX][measurement2][unitX][measurement..n][unit..X]

[measurement1][unitZ][measurement2][unitX][measurement..n][unit..Y]

[measurement1][unitZ][measurement2][unitY][measurement..n][unit..Z]

 

and so on. My calculations expect the data to be meters, so i have to convert the measurements to meters before i begin my calculations. 

How would you go about dynamically converting these measurements to meters, when the units can jump around all over the place?

5 REPLIES 5
PhilipMannering
16 - Nebula
16 - Nebula

Could you do a find and replace on the unit? (I guess you would need to do this three times, unless you pivoted your data) So if you find an inch, append the value 0.0254, 'meter' => 1, etc. Then multiply by that conversion factor for each of your measurements.

 

If you provide some dummy data, I can mock something up.

 

Philip

3p_khr
6 - Meteoroid

Hi Philip, i have been looking at the dynamic replace, but in the end i had to give up.
I would love to see your solution to my problem. I have attached some mock data.

3p_khr
6 - Meteoroid

It probably should be noted that there can be different amount of columns. in the mock i have depth, height, width, but a lot of other measurements can be present as well such as length, offset etc. so i feel like it has to be handled dynamically.

PhilipMannering
16 - Nebula
16 - Nebula

Hi @3p_khr ,

 

Perhaps something like the solution attached would work. You would just need to manually add the conversion amounts to the Text Input Tool.

 

PhilipMannering_0-1613648053745.png

 

Hope this helps,

Philip

3p_khr
6 - Meteoroid

Hi Philip.

This is just what i was looking for, what an elegant solution. 
Thank you very much for the help. 

Labels