Median Calculation

  • 1
  • Question
  • Updated 2 years ago
  • In Progress
Has anyone used a snippet or ui-only field to calculate the median for an aggregate model?
Photo of Jack Sanford

Jack Sanford, Champion

  • 9,766 Points 5k badge 2x thumb

Posted 2 years ago

  • 1
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 18,126 Points 10k badge 2x thumb
No, but rough thought:

Do an aggregation of countId. This would give you the total number of rows.

Create a second model that is a regular model with the same conditions as the aggregate sorted in ascending order for the value you need the median for. This will load the individual rows in. You could then have a UI only formula field that references the value of the nth row in the regular model based on the countId of the agg model divided by 2 rounded to the nearest whole number minus 1 since the first row is row 0.