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.

Need help with an exercise

sameersheikh
8 - Asteroid

Hello All,

 

I'm not sure how exactly to do this, given it's through the Alteryx Academy at a local community college.  Am I allowed to post the file?  I think that would be the best way to get help because you'll be able to see my workflow.  Otherwise, I'm not sure that I'll be able to do a good job in explaining the issue.

 

Anyways, here's the question:

 

Reduce the data set to just the consignments with compensation. Convert the compensation to GBP for the consignments that are currently in USD and provide the following metrics:
a. the total number of compensation claims to be paid, and the total value of those claims
b. the total compensation from each carrier rounded to the nearest GBP
c. the top 3 months in terms of compensation claims to be paid, rounded to the nearest one hundredth, and with the € symbol

First of all, the rounding is killing me.  I have no clue how to round to the appropriate 2-decimal digit number.  Round and the other one Ceil, iirc, don't do this.  They round to an integer.  Next, I am completely clueless when it comes to c.  I have no clue where to begin because the lesson didn't give us the tools or methods on how to do what it's asking - again with the rounding to the nearest hundredth and this appending of the Euro character.

 

I tried converting the data from fixed decimal to a string, using ToString(), but Alteryx didn't like it.  And honestly, that's about the only tool in my bag of tricks for dealing with the question.

EDIT:

I'm going to include the question and what I've done.  You can see my results along with the solution results - they're quite different.  If this is a violation of the ToS, then I'll take it down.  I feel that this isn't going to make much sense, unless you all can see what I'm working with.

 

16 REPLIES 16
Deano478
12 - Quasar

@sameersheikh to get the values to 2 decimal places you can just use the select tool and set it fixed decimal type and 19.2 size and for the € symbol something like this should work

 

'€' + ToString([Data])

 

 

gawa
16 - Nebula
16 - Nebula

@sameersheikh 

 

Have you tried Round() function?

image.png

sameersheikh
8 - Asteroid

I tried the   

 

'€' + ToString([Data])

 

and it didn't work.

 

I got the following error:

 

Formula (404) The formula "Compensation in GBP" resulted in a string but the field is numeric. Use ToNumber(...) if this is correct. (Expression #1)

sameersheikh
8 - Asteroid

Interesting about Round().  It was not working.  Everything I read showed that it rounded to an integer.  I didn't know you could specify anything a decimal.  I ran it, and it kind of worked.  It does truncate the trailing zero, which I'd like to include.

CoG
14 - Magnetar

That is incorrect (about the round tool). I was not used to the way the function worked when I first began using it, which led to frequent confusion and frustration on my part.

  • Round( [Number], x ) - The 'x' is not how many decimal places to round, but the multiple to round to. As @gawa - mentioned, Round( [Number], 0.01), would work out to 2 decimal places rounding (just make sure your data type is correct to handle decimal points)

The formula error means that you are outputting a string into a numeric column, which won't work. Either change the data type via drop-down or you will need to make a new field to store the output in.

2023-11-15_15-26_Rounding.png

sameersheikh
8 - Asteroid

I've changed the data type from Fied Decimal to Int64; when I did that, I lost the decimals.

CoG
14 - Magnetar

Exactly, do not use Int types if you want decimal values. The image I provided was for reference only, not advice on proper data types since you have a few different types it sounds like you are working with. The main point is to just make sure that you are using the correct ones.

sameersheikh
8 - Asteroid

Anyone been able to look at the workflow that I've included?  Others, when doing this exercise, are getting the identical numbers to the solutions, so I'm clearly not doing something right.

CoG
14 - Magnetar

I looked at your workflow, and in the spirit of you doing your own work, I will provide you with a few pointers to help guide you, without giving you the answer:

  1. Read the instructions very carefully and follow them step by step (your current workflow does not do this, and this is causing you most of your problems)
  2. I also recommend deleting your work for the third question and re-working it, because there are many mistakes there and redundancies that will only confuse you further. Start that part of the flow again with a clean slate and see if you can figure it out.
  3. Also for the third question don't forget that you have 2 date columns.

You are not far off. Best wishes! You can do it!!!

Labels