Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Designer Desktop Discussions

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

Decimal to read correctly

Inactive User
Not applicable

Hi Team,
I have a data sets which i need to convert this numerical as per below

 

Description14
30
27.5
25.01

 

30 to read as "30.0" , 27.5 to read only as "27.5" and 25.01 to read as "25.01" - how can we set a formula for decimal integers to read it correctly ? 

Thanks so much ! 

Regards,

Guru

8 REPLIES 8
Emil_Kos
17 - Castor
17 - Castor

Hi @Inactive User,

 

with your example, you can just change the data type to double and it will work.

 

If you will get a coma instead of a dot it would be more complicated but I have show both solutions in the workflow.

 

 

Inactive User
Not applicable

Hi @Emil_Kos 

Thanks for your response - I have a huge data set will have to set a formula which identifies below scenario's.
Numeric 30 to read as "30.0" and

no changes if data set shows as "27.5" to read as 27.5 and

25.01 to read it as 2 decimal points... Please advice.

 

apathetichell
20 - Arcturus

I'm not sure you can get what you want - fixed decimal can (theoretically) enforce a set number of decimal  spaces and double will allow you to have differing number of decimal places - but double does not create a whole number with a trailing decimal. So it seems to me like you want two different numeric types in the same column.

 

If it's for string display purposes may I present:

if REGEX_Match(tostring([test]),"\d+") then tostring([test])+(".0") else tostring([test]) endif

jrgo
14 - Magnetar

@Inactive User 

 

Only way is if that field is converted to a STRING data type where you can customize the output. If that would be acceptable, the expression below used to create a new field would produce the desired format.

REGEX_REPLACE(TOSTRING([Description14], 2), '^(.+)0$', '$1')

 

jrgo_0-1619474133891.png

 

Hope this helps!

 

Jimmy

Emil_Kos
17 - Castor
17 - Castor

Hi @Inactive User,

 

Now I know that I didn't understand your initial question correctly.

 

I believe @apathetichell and @jrgo got valid points in order to how you can tackle this problem.

 

One more question to you @Inactive User what is the reason that you want to highlight the data in this way? 

Inactive User
Not applicable

Thanks !

Inactive User
Not applicable

I wanted to build a logic to match primary data with Alteryx output, hence i need a logic to build in such a way.  

Emil_Kos
17 - Castor
17 - Castor

Hi @Inactive User,

 

Thank you for your explanation. Good luck with your project. I think @jrgo and @apathetichell provided you with valid answers that should help you along the way 🙂 

Labels
Top Solution Authors