# Re: Sum two fields in another field

Solved
1823 0
cancel
Showing results for
Did you mean:
5 - Automation Enthusiast

Hello,

I’m Spanish and I can speak a little English. I’m new in Airtable, sorry if my question is too easy for you.
I have a shoop with several makers (“Créateur”) I would like to sum “Prix” for each “Créateur” in the field “Total pour créateur”
I’ve made a formule with SWITCH but its does’nt work {Prix} + SWITCH( { Créateur }, “Sophie”, SUM, “Mathilde”, SUM, “LMC”, SUM )
Can you explain how to find the solution ?

Thanks
Date____________.Créateur_________Prix_________Total pour créateur
5-3-21___________Sophie___________80_______________80
5-3-21 __________Mathilde __________60_______________60
5-3-21 __________ LMC ____________50_______________50
5-3-21__________Sophie ___________20 ______________ 100

1 Solution

Accepted Solutions
18 - Pluto

Airtable isn’t like a spreadsheet where you can create a running total across several lines. (There are some workarounds to sorta-kinda make this work, but they’re frankly quite messy, and I don’t recommend them.) The key thing to remember is that Airtable is more like a database, and every record (row) is completely independent of every other record. When a formula runs in a formula field, field references used in the formula are only calculated at the record level, and there’s no way to directly access values from other records.

If a running total is important for your use case, I recommend searching the forum using those keywords, and you’ll likely find other threads where the workarounds that I mentioned above are discussed. From my experience, though, having a running total isn’t always as useful as it sounds, and the final total is the important value. If that will work for your use case, there’s a relatively easy way to set this up.

First off, create a table for tracking all of your makers, perhaps naming it “Créateurs” (I’ll refer to it as `[Créateurs]` to indicate that it’s a table, as opposed to `{Créateur}` which I’ll use to refer to the field you mentioned). Add all of your creators to that table, then turn your `{Créateur}` field into a link field where you choose the maker for each item/project. With that set up, your main table might look like this:

To make each record unique, I’ll combine the date, creator’s name, and price in a formula, which gives us this:

Now looking at the `[Créateurs]` table, I can see the incoming links from the individual transaction records:

In this table, add a rollup field. Rollup fields are used to collect and process values from linked records. In this case, we can add up all of the values from each creator’s transactions. Here’s the rollup field’s setup:

Once added, the `[Créateurs]` table looks like this:

5 Replies 5
18 - Pluto

Airtable isn’t like a spreadsheet where you can create a running total across several lines. (There are some workarounds to sorta-kinda make this work, but they’re frankly quite messy, and I don’t recommend them.) The key thing to remember is that Airtable is more like a database, and every record (row) is completely independent of every other record. When a formula runs in a formula field, field references used in the formula are only calculated at the record level, and there’s no way to directly access values from other records.

If a running total is important for your use case, I recommend searching the forum using those keywords, and you’ll likely find other threads where the workarounds that I mentioned above are discussed. From my experience, though, having a running total isn’t always as useful as it sounds, and the final total is the important value. If that will work for your use case, there’s a relatively easy way to set this up.

First off, create a table for tracking all of your makers, perhaps naming it “Créateurs” (I’ll refer to it as `[Créateurs]` to indicate that it’s a table, as opposed to `{Créateur}` which I’ll use to refer to the field you mentioned). Add all of your creators to that table, then turn your `{Créateur}` field into a link field where you choose the maker for each item/project. With that set up, your main table might look like this:

To make each record unique, I’ll combine the date, creator’s name, and price in a formula, which gives us this:

Now looking at the `[Créateurs]` table, I can see the incoming links from the individual transaction records:

In this table, add a rollup field. Rollup fields are used to collect and process values from linked records. In this case, we can add up all of the values from each creator’s transactions. Here’s the rollup field’s setup:

Once added, the `[Créateurs]` table looks like this:

5 - Automation Enthusiast

Thanks very much. I’m trying to do your explication. Your message seems to me really clear. :slightly_smiling_face: .
Before your message I’ve tried to do relations between tables but I’m not very good for the moment. :grinning_face_with_big_eyes:
Thanks a lot

5 - Automation Enthusiast

I can resolve my problem, thanks a lot

18 - Pluto

Glad to know that you found a solution! If my comment above helped, please mark it as the solution to your question. This helps others who may be searching with similar questions. Thanks!

5 - Automation Enthusiast

I have a new question :grinning_face_with_big_eyes: .
Now my two tables are linked,

Unfortunately I must set the data manually in the second table. Is possible in airtable to enter this data one time only and not to search these data in the square at the right, like you can see in the second photo ?