Help with Sum / Filter

Hi All - I’m new to Coda and the community. I’ve searched for this topic but still no luck.

I’m looking to sum the Total Fee for Fees in my table with a particular Timing type.

I’m getting an error that says incorrect argument type - saying that the formula was expecting to find a different data type.

My Fee Total column is a formula and I’m not sure if that is the problem. The formula is a series of IF statements that determines the fee calculation based on the Basis column. I did a copy of the column, values only, to see if it would make a difference but it didn’t. The Fees total fine without the filter so I have something wrong there.

Here is an image:

Appreciate any assistance!
Thanks,
Ann

Hi @Ann_Hannan and Welcome to the Community :partying_face: !

I think this should work :

Fees.Filter(Timing = "IF Level").[Fee Total].Sum()

Or this should work too :

Fees.Filter(Timing.Contains("IF Level")).[Fee Total].Sum()

What both formulas do is :

  1. They take all the rows in your table Fees and using Filter() only keep the rows where CurrentValue.Timing = "IF Level" (or CurrentValue.Timing.Contains("IF Level")).

  2. From the list of rows returned by Filter(), we can then access their property [Fee Total], so the list of rows becomes here a list of numbers.

  3. Sum() the list of numbers :blush:

Don’t hesitate if you have any questions or if it doesn’t work as expected (:sweat_smile:).
But I hope this will help you a little :innocent:

1 Like

Perfect! Thank you so much for your quick response.

Ann

My pleasure @Ann_Hannan :grin: !

I’m very glad to know this helped you moving forward :raised_hands: !

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.