Creating a SumIF or Sum of Filtered Values

Hi Thunkers,

I’ve been trying to figure something out for a few days with no luck so wanted to ask the community.

What I’m trying to do:
From a list of values (stored as a local table), let’s call it a shopping list with category (fruit, pizza, etc) and prices per item. I want to create a second table that aggregates the total price for each category. In excel, this would operate as a sumif function (sumif category value is equal to ‘pizza’.)


Thunkable (link expires 10/2/21)

What I think I’m doing (going down the blocks):

  1. clearing my second table of any values
  2. For each item in my clean list (this is a list of category values)
  3. Set app variable objectcontainer to a row of data from my raw data table
  4. If the category name is equal to j, build a list of prices from the raw data table
  5. create a row in my second table that has category (j) and a sum of the list I created above

Other topics I tried:
The topics I could find relate to summing a list, but I couldn’t find anything I could build on when it came to filtering a list prior to summing. Apologies of I missed a good string out there.

1 Like

The first think I noticed is the get row object from is not supplied with any row id therefore everything else will fail.

2 Likes

@muneer thank you for the nudge. I think I found a solution, pasted below after working through your advice.

Though, I’d open it up to any thunkers. Is this the best way to accomplish a sumif? Is there a more efficient way?

Thanks