# Applying additional formulas to rollups or the equivalent

**URL:** <https://community.glideapps.com/t/applying-additional-formulas-to-rollups-or-the-equivalent/58438>\
**Category:** Ask for Help\
**Created:** [February 24, 2023, 4:22pm UTC](https://community.glideapps.com/t/applying-additional-formulas-to-rollups-or-the-equivalent/58438 "2023-02-24T16:22:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pigeonflight](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pigeonflight/32/54611_2.png) [@pigeonflight](https://community.glideapps.com/u/pigeonflight)\
**Post date:** [February 24, 2023, 4:22pm UTC](https://community.glideapps.com/t/applying-additional-formulas-to-rollups-or-the-equivalent/58438/1 "2023-02-24T16:22:50Z")

</div>

I want to be able to apply a calculation to a rollup but it isn’t available out of the box. What would be the equivalent of this in glide?  
I imagined that I might be able to add additional formulas to rollups but this doesn’t seem possible.

I know I can [calculate the average of values in a rollup](https://community.glideapps.com/t/group-by-multiple-columns-to-perform-a-calculation/58364/16)

In this case, I want to calculate the sum of the two highest values in my rollup.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [February 24, 2023, 4:31pm UTC](https://community.glideapps.com/t/applying-additional-formulas-to-rollups-or-the-equivalent/58438/2 "2023-02-24T16:31:18Z")

</div>

> [@pigeonflight](#):
>
> In this case, I want to calculate the sum of the two highest values in my rollup

You’d have to combine a few columns. Perhaps something like:

- Use a lookup through the associated relation to get an array of all values
- Sort the array using the array sort plugin
- Use two single value columns to pick out the last two items
- Sum those using a math column

If you know JavaScript, then a more efficient way would be to grab a joined list of all values through the ~~array~~ relation, and then process that with a JavaScript column.

---

<div class="post-metadata">

**Author:** ![pigeonflight](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pigeonflight/32/54611_2.png) [@pigeonflight](https://community.glideapps.com/u/pigeonflight)\
**Post date:** [February 24, 2023, 4:43pm UTC](https://community.glideapps.com/t/applying-additional-formulas-to-rollups-or-the-equivalent/58438/3 "2023-02-24T16:43:49Z")

</div>

> [@Darren\_Murphy](#):
>
> process that with a JavaScript column.

Interesting… didn’t know about the javascript column. Thanks @Darren_Murphy still on the learning curve.

---

<div class="post-metadata">

**Author:** ![pigeonflight](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pigeonflight/32/54611_2.png) [@pigeonflight](https://community.glideapps.com/u/pigeonflight)\
**Post date:** [February 24, 2023, 5:12pm UTC](https://community.glideapps.com/t/applying-additional-formulas-to-rollups-or-the-equivalent/58438/4 "2023-02-24T17:12:30Z")

</div>

> [@Darren\_Murphy](#):
>
> Use two single value columns to pick out the last two items

Thanks @Darren_Murphy… ended up using a javascript column to do the final manipulation.
