KNOWLEDGE BASE

Rounding Numbers Up to the Next Integer


Published: 16 Jun 2014
Last Modified Date: 02 Jan 2019

Issue

How to round numbers up to the next integer.

Environment

Tableau Desktop

Resolution

  1. Create a calculated field that finds the last digit of the number. For example: FLOAT(RIGHT(STR([Amount]),1)). In this case 1.2 will return a value of 2. 
  2. Create an IF statement that uses this amount, and then adds the number necessary to round up to the next whole number:
    If [Last Digit In Field] > 0 Then [Amount] + ((1 - [Last Digit In Field]*.1))
    Else [Amount]
    End

Additional Information

Tableau 10.3 also has CEILING() and FLOOR() functions that can solve this type of calculations without needing to do string conversions.
 

Discuss this article... Feedback Forum
Did this article resolve the issue?