Window function, group by

Topic Labels: Formulas
1096 2
Showing results for 
Search instead for 
Did you mean: 
4 - Data Explorer
4 - Data Explorer

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
4 - Data Explorer
4 - Data Explorer

Capture du 2020-04-05 23-02-24

(post deleted by author)