Truncate function like in Excel
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
Solved! Go to Solution.
- Labels:
- Data Investigation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you so much.
