Occasional Contributor

Truncate decimals but not round

Hi All,

 

I want to truncate the decimals from a number like below but do not want to round it.

 

2.22939393 -> 2.229

2.22977777 -> 2.229

2.59999 -> 2.5 instead of 2.6

4 REPLIES 4
Highlighted
Master Anaplanner/Community Boss

Re: Truncate decimals but not round

Seems that would always be a round down.

Can you use the ROUND function?:  ROUND(Line Item, [decimal places], DOWN]

Jared Dolich - Retail, Wholesale, eCommerce Analyst
Highlighted
Occasional Contributor

Re: Truncate decimals but not round

Hi, Thanks for your reply but Round down will not work as it will round 3.4562 to 3.0 instead of 3.4. I want a way to truncate the number till the first decimal

Highlighted
Community Boss

Re: Truncate decimals but not round

truncate isn't the right word, you want to round down to a specific decimals. In which case Jared anser's is correct, round allows you to do that

https://help.anaplan.com/anapedia/Content/Calculation_Functions/All/ROUND.html
Nathan Rudman
Anaplan Model Builder
Highlighted
Community Boss

Re: Truncate decimals but not round

If you do not want to round then your only other option is text cutting.

You can do LEFT(TEXT(number line item),5)

You can have an IF statement to not always take the 5 first (2.229) but the first three (2.5), depending on a numeric condition.

Nathan Rudman
Anaplan Model Builder