Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

D toc

Excerpt

Rounds input value to the nearest integer. Input can be an Integer, a Decimal, a column reference, or an expression. Optional second argument can be used to specify the number of digits to which to round.

  • When rounding to nearest integer, decimal values that are X.5 or more are rounded to X+1

D s
snippetBasic

Numeric literal example:

D code

derive type:single value: ROUND(2.5)

Output: Generates a column with each row's value 3.

Expression example:

D code

derive type:single value: ROUND(MyValue + 2.5)

Output: Generates a column containing the nearest integer to the sum of 2.5 and the value in the MyValue column.

Numeric literal example:

D code

derive type:single value:ROUND(PI(),4)

Output: Generates a column containing pi rounded to four decimal points: 3.1416.

D s
snippetSyntax

D code

derive type:single value: ROUND(numeric_value, integer_value)

ArgumentRequired?Data TypeDescription
numeric_valueYstring, decimal, or integerName of column or Decimal or Integer literal to apply to the function
integer_valueNinteger

Number of digits to which to round.

  • Default is 0, which rounds to the nearest integer.
  • Negative integer values can be applied.

D s lang notes

numeric_value

Name of the column, numeric literal, or numeric expression.

  • Missing input values generate missing results.
  • Literal numeric values should not be quoted. Quoted values are treated as strings. 
  • Multiple columns and wildcards are not supported.

D s
snippetusage

Required?Data TypeExample Value
YesString (column reference) or Integer or Decimal literal2.5

integer_value

Number of digits to which to round the first argument of the function.

  • Positive values values truncate to the right of the decimal point.
  • Negative values truncate to the left of the decimal point.
  • Missing input values generate missing results.

Usage Notes: 

Required?
Data Type
Example Value
NoInteger literal3


D s
snippetExamples

Example - Exponential functions

Include Page
EXAMPLE - Rounding Functions
EXAMPLE - Rounding Functions

Example - RANDBETWEEN and PI and ROUND functions

Include Page
EXAMPLE - RANDBETWEEN and PI Functions
EXAMPLE - RANDBETWEEN and PI Functions

D s also
labelmath