Group by count and group by sum on same data


My bubble app tracks jobs on assets like vehicles. Each job could have multiple users log hours against the job. So the data could look like this:


Asset A2 has two jobs on it, completed by 3 people over 9 hours. I want to produce an output like this in a repeating group:

Data Output

I can produce the data grouped by job, or hours, but not both. For example, grouped by hours is

Select for logs group by asset group by sum of hours

Any ideas?

Why wouldn’t you break this up into two different Things?

Asset Thing
Job Thing

Asset Thing has

  1. a ID (if you need it to match with an external system, otherwise Bubble will manage unique ID’s for you as with any Thing)
  2. Asset Name as Text
  3. Jobs (List of Job Things relationship)

Job Thing has

  1. Job #
  2. User
  3. Hours
  4. of Asset (Asset Thing relationship, not a list)

Entering data would be a two step process: Creating or selecting the asset, then creating or selecting a job#, then adding hours (assuming the user is logged in you can use the created by data for the user)

Then you can easily create Repeating Group across all Assets, and for each you show all related jobs’ (or jobs :count as in your exampe) plus the sum of the jobs hours.

This topic was automatically closed after 70 days. New replies are no longer allowed.