# Cross table - math functions

**URL:** <https://community.glideapps.com/t/cross-table-math-functions/59584>\
**Category:** Ask for Help\
**Created:** [March 23, 2023, 3:16pm UTC](https://community.glideapps.com/t/cross-table-math-functions/59584 "2023-03-23T15:16:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kendall\_Hines](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/kendall_hines/32/34228_2.png) [@Kendall\_Hines](https://community.glideapps.com/u/Kendall_Hines)\
**Post date:** [March 23, 2023, 3:16pm UTC](https://community.glideapps.com/t/cross-table-math-functions/59584/1 "2023-03-23T15:16:39Z")

</div>

Use Case: I am trying to calculate the Cost Per Lead for multiple businesses that use my app

I have the sum of $ paid by CompanyID for marketing in one pivot table as a data source

I have the sum of # of leads generated by companyID in another data source within glide

Question how could I perform cross-data source math calculations on the glide side? Is this possible?

Thank you!

---

<div class="post-metadata">

**Author:** ![Kendall\_Hines](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/kendall_hines/32/34228_2.png) [@Kendall\_Hines](https://community.glideapps.com/u/Kendall_Hines)\
**Post date:** [March 23, 2023, 3:39pm UTC](https://community.glideapps.com/t/cross-table-math-functions/59584/2 "2023-03-23T15:39:34Z")

</div>

Holy FUCJCJKSKSK GPT 4 for the win!!

=ARRAYFORMULA(  
{  
{“Comp\_id”, “SUM of Clicki Balance”, “Cost Per Lead”};  
‘Pivot Table 2’!A2:B,  
IFERROR(  
‘Pivot Table 2’!B2:B /  
VLOOKUP(‘Pivot Table 2’!A2:A, ‘ReferralSummaryPivot’!A2:B, 2, FALSE)  
)  
}  
)

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [March 23, 2023, 3:47pm UTC](https://community.glideapps.com/t/cross-table-math-functions/59584/3 "2023-03-23T15:47:31Z")

</div>

That’s a sheet formula. I imagine you could do the same thing in Glide with a relation and rollup, with a math column to handle any other math you need.

---

<div class="post-metadata">

**Author:** ![Kendall\_Hines](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/kendall_hines/32/34228_2.png) [@Kendall\_Hines](https://community.glideapps.com/u/Kendall_Hines)\
**Post date:** [March 23, 2023, 3:52pm UTC](https://community.glideapps.com/t/cross-table-math-functions/59584/4 "2023-03-23T15:52:45Z")

</div>

Ya ended up doing it on google sheet side. Seemed to be the quickest path. Glide was not working for some reason - likely user knowledge error LOL
