Alteryx Designer Desktop Discussions

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

Truncate function like in Excel

levpo
Meteoroide

Hi Everyone,

 

I'm trying to get the same results of truncate as in Excel.

Please take a look when I divide =TRUNC(20/42489.31,8) in excel and get the last 8 decimal the result is   0.0004707

But when I do the same calculation using alteryx I get 0.00047071.

I tried all the solution that proposed to me.

Attached the screenshot of the proposal that I found to do round Multiple and divide by the number of decimal FLOOR([result]*100000000)/100000000 in Formula it present correctly but in output not.

 

Attached screenshot and the workflow.

 

Thanks in advance

5 RESPOSTAS 5
DavidP
17 - Castor
17 - Castor

I would do it like this:

 

1. Force rounding to 9 decimals

2. Convert to string

3. Shorten the string by 1

4. Convert back to a number

 

You can also do it with Regex

 

DavidP_0-1640127795065.png

 

binuacs
Arcturus

@levpo your formula is correct, only difference is that multiply with 10,000000

Saqueador
binuacs_1-1640159582865.png

 


 

levpo
Meteoroide

Thanks for both response

 

The problem is that I would like in both scenarios to have 8 digits but it will work like in truncate

This example is another one

250/42489.31 and truncated to 8 decs in Excel should be 0.00588383 vs what alteryx is currently giving: 0.00588382
please advice
DavidP
17 - Castor
17 - Castor

Hi @levpo 

 

Both methods will work. I attach the workflow that illustrates the method in my first post. Use Fixed Decimal datatype to restrict the output to 8 decimals.

 

DavidP_0-1640209459975.png

 

levpo
Meteoroide

Thank you so much.

Rótulos