OpenBI Docs Buy

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>] )
ParameterTypeDescription
numberNumberThe number to cut.
num_digitsWhole 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 INT away 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.7894.789 to 2-1234.5 to -2
4-44.78-1200

INT, ROUNDDOWN, ROUND, QUOTIENT.

Last updated · OpenBI Studio 0.3.74