TRUNC
A number with its decimals cut off, or cut to a number of decimals.
Group: Math. Compatible with DAX.
Syntax
TRUNC ( <number> [, <num_digits>] )
| Parameter | Type | Description |
|---|---|---|
number | Number | The number to cut. |
num_digits | Whole number optional | How many decimals to keep; 0 when left out. A negative number cuts to tens, hundreds and so on. |
Returns
Number. The number with the decimals past num_digits dropped, towards zero.
Remarks
- Nothing is rounded:
TRUNC ( 4.789, 2 )is 4.78. - For negative numbers TRUNC goes towards zero and
INTaway from it:TRUNC ( -4.7 )is -4,INT ( -4.7 )-5. - It does the same as
ROUNDDOWN, but num_digits may be left out. - A blank gives BLANK.
Examples
Cutting decimals
EVALUATE
ROW (
"4.789", TRUNC ( 4.789 ),
"-4.789", TRUNC ( -4.789 ),
"4.789 to 2", TRUNC ( 4.789, 2 ),
"-1234.5 to -2", TRUNC ( -1234.5, -2 )
)
| 4.789 | -4.789 | 4.789 to 2 | -1234.5 to -2 |
|---|---|---|---|
| 4 | -4 | 4.78 | -1200 |