community
cancel
Showing results for 
Search instead for 
Did you mean: 
Do you have the skills to make it to the top? Subscribe to our weekly challenges. Try your best to solve the problem, share your solution, and see how others tackled the same problem. We share our answer too.
Weekly Challenge
Do you have the skills to make it to the top? Subscribe to our weekly challenges. Try your best to solve the problem, share your solution, and see how others tackled the same problem. We share our answer too.
Unable to display your progress at this time. Please try again a little later, or contact an administrator if you continue to see this error.
Getting started with Designer? | Start your journey with our new Learning Path!

Challenge #183: Roman Numeral Math

Asteroid

Here is my solution but I can't figure out how you got to that result without respecting math order of calculations PEDMAS?

 

Alteryx
Alteryx

I would have had this done an hour ago, but I was trying to figure out why I was getting the "wrong" answer.

Spoiler
Didn't know about Dynamic Replace so I used a macro, but I did learn something new today. Thanks, Martyn!!
Asteroid

My solution here.

Asteroid

I took this challenge to practice some REGEX to separate the fields. 

 

Parse: (.*?)\+\s(\*?)\s(.*?)\+\s(\/?)\s(.*?)\+\s{2}(\+?)\s(.*?)\+\s(\-?)\s(.*)\+

 

Spoiler
2019-09-30_11-11-04.jpg
Bolide

Installed custom functions to try fromRoman() .   More details here :  https://community.alteryx.com/t5/Engine-Works-Blog/An-Overview-of-the-Alteryx-Abacus-Add-In/ba-p/398...

 

This is a good example  for 'find and replace' and  'dynamic replace'. 

 

Meteor

I too got a weird number doing things in the correct order of operations.  

Spoiler

Maybe the romans did a different order of operations?  I took each value, the equation into words vs. operators.  Joined by record position to each other so we'd know the function to be performed on the following line.  I used a batch macro to convert to standard numbers by dividing each symbol into rows, determining via multi-row if it was a "subtractor" or an addition value and then summed the values up.  I then put this into an sort by Order of operations and position ranking so * and / came first then by relative position followed by +/- and relative position left to right.  I ran this through an iterative macro and took the final output as the value.
Screen Shot 2019-09-30 at 12.09.30 PM.pngScreen Shot 2019-09-30 at 12.09.40 PM.pngScreen Shot 2019-09-30 at 12.09.51 PM.png
Comet

Without additional information, I am going to say the PEMDAS answer is correct, which is what I tie to.

 

Spoiler
Macro 183.JPG

 

Workflow 183.JPG

 

Comet
Spoiler
Like others I didn't get the supplied answer as I followed the order of operations (being a Brit I know it as BODMAS (Brackets, Orders, Division, Multiplication, Addition, Subtraction)) and got 15,197 which is similar to others.

Originally approached it by summing the numeric value of the roman numerals but this doesn't work as IX is 9 and not 11 (if you sum them), so built in some logic to add in hierarchy to the roman numerals.

Challenge 183.PNG
I also ended up with a long multi-row formula to do the maths bit
Asteroid
Spoiler
image.pngI had no idea how to convert a field into a formula until I saw Martyn's solution with the Dynamic Replace, so thanks!
image.png

Challenge #183 solved!

 

Alteryx Certified Partner

Good challenge. First time I've use the dynamic replace - essentially as an 'eval' function. Solution attached.

 

Spoiler
Challenge 183 - Snip.jpgworkflow