function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Amanda HollowellAmanda Hollowell 

Round() function available is SOQL?

Is the ROUND() function available in SOQL?

I am using a SOQL query to average all the records in a formula field (This formula field calculates the time between two date fields)
Currently when I calculate the average for the formula field it includes two decimal places. I would prefer the result only include whole numbers.

Thanks in advance for your help!
Best Answer chosen by Amanda Hollowell
James LoghryJames Loghry
There is no ROUND function in SOQL, but there are ROUND, CEIL (Ceiling) and FLOOR functions in both Apex (using the Math class) and Visualforce functions.

All Answers

James LoghryJames Loghry
There is no ROUND function in SOQL, but there are ROUND, CEIL (Ceiling) and FLOOR functions in both Apex (using the Math class) and Visualforce functions.
This was selected as the best answer