Help

Upcoming database upgrades. Airtable functionality will be reduced for ~15 minutes at 06:00 UTC on Feb. 4 / 10:00 pm PT on Feb. 3. Learn more here

Window function, group by

Topic Labels: Formulas
482 2
cancel
Showing results for 
Search instead for 
Did you mean: 

Hello all.

I want to do a simple sum on a group by.

In my example, I am building a recipe calculator and want to find out the proportion of cost for each ingredient out of the total cost.

My formula would be : cost/sum(cost group by recipe)
In sql this is call a window function but I am not sure if there is the equivalent in Airtable.

I have a screenshot, but seems like I cannot upload it.
Must be because I’m a new in the community.
Anyway let’s say i have

recipe_a ingredient_a $3
recipe_a ingredient_b $6
recipe_a ingredient_c $4
recipe_a ingredient_b $2

I want a new column that would output that ingredient_b stands for 1/3 of the cost of recipe_a

A workaround is to do a pivot table but it seems like a lot of trouble for something simple (plus not a very scalable solution)

If you have any input, I’ll gladly take some.

Thank you
Stay safe !

2 Replies 2

(post deleted by author)