Appsheet SUM function

Hi, new to Appsheet. I am creating a PD database to track PD usage by staff. I have a main table with every employee and every employee has a unique Employee ID. I have a second table that stores the PD funds employees can accumulate, referencing the Employee ID from the main table. An employee can have multiple entries on this table for every instance they earn PD funds. I am using their Employee ID in every row on this table. I would like to total the amount of PD funds they have earned based on their Employee ID. I have tried using the SUM function but cannot work out the proper phrasing. Any input would be greatly appreciated. Thanks.

0 6 152
6 REPLIES 6

If you want to show in the 'Employees' table the accumulated amount of PD per employee captured in the 'funds' table, then an expression to capture that information would be

SUM(
 SELECT(
  funds[amount],
  [emp ID] = [_THISROW].[emp ID]
 )
)

Another simpler way to be written in the Employee table:

SUM([Related funds][amount])

 

This option is good because it does not involve a new SELECT() but rather uses the Virtual Column created by the system and that saves resources, in addition to filtering the related records. It is a sum of a dereferenced list expression.

Thank you, this worked great for me.

If you have the Funds as an inline view (Ref is in use), you could group it with the employee and use the aggregated sum. Then no additional columns or calculations are needed ๐Ÿ˜‰

Thank you all for your input. I look forward to using AppSheet in more detail.

Top Labels in this Space