round/truncate averages in aggregate models

  • 1
  • Question
  • Updated 3 years ago
Is there a way to truncate/round an average field in an Aggregate Model?
I want to show two decimal places via merge syntax in a rich text area.

I tried to use a formula field, but I had two problems:
  1. The ROUND function rounds to the nearest integer (no decimals).
  2. The formula fields don't seem to respect the metadata settings for decimals (see below)
Here are my formula field settings:
 
(field should only display two decimal places)

 
(just a copy of the AVG() function from the aggregate model.


And here's what I get in runtime:
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Well, here's a really stupid way. With the forumal set to return TEXT instead of a number, make this the formula:

FLOOR({{{avgGestation}}}) + '.' + ROUND( ( {{{avgGestation}}} - FLOOR({{{avgGestation}}}) ) * 100 )