6 Replies Latest reply on Oct 27, 2017 8:25 AM by Keir Blockley

# How to round to nearest 5

Hi

Please can someone help with how to round to the nearest 5. So 1 and 2 would be 0, 3 and 4 would be 5, 91 would be 90, 138 would be 140 and so on.

The data will be based on whole numbers so no need to factor in decimals.

Thanks

Keir

• ###### 1. Re: How to round to nearest 5

Hi Keir,

I must come back to you with a much smarter approach provided by Shawn Wallwork

Round([value]/5)*5

Thanks  Shawn Wallwork;) learned a lot  agiain.

PS removed the initial post because it was not correct

Regards,

Norbert

3 of 3 people found this helpful
• ###### 2. Re: How to round to nearest 5

Norbert

Thanks for the response, I have tried this and it is still displaying the original value i.e. 84 is still displaying as 84 rather than 85.

Just to check I am not missing something simple, I have created a calculated field on "number of records" which is showing as:

Round([Number of Records]/5)*5

Thanks

Keir

• ###### 3. Re: How to round to nearest 5

We're going to need to see a sample packaged workbook showing this behavior. Please mention what version of Tableau you are using. There were some rounding issues is some of the releases of Tableau.

• ###### 4. Re: How to round to nearest 5

Shawn

I've attached the workbook. It's only sample data as I am testing that I can do this for a future piece of work.

Tableau version is 10.2.1

Thanks

Keir

• ###### 5. Re: How to round to nearest 5

In Tableau where you do the aggregation and how the viz is set up makes all the difference:

Round(SUM( [Number of Records] )/5)*5

Results in this:

This is why we almost always ask for a sample workbook.

--Shawn

• ###### 6. Re: How to round to nearest 5

Shawn

Thanks for your help with this, it has worked now.

Keir