# A repeating group in which each cell is a 'group by' of a data table

I have a table:
Bruce - Stationary - £10
Bruce - Travel - £20
Bruce - Accomodation - £50
Andrew - Stationary - £20
Andrew - Travel - £30
Andrew - Accomodation - £60
Geoff - Stationary - £5
Geoff- Travel - £25
Geoff- Accomodation - £40

I’d like to show each person and total cost in a repeating group:

Eg. Costs Repeating Group

1. Geoff - £70
2. Bruce - £80
3. Andrew - £110

Is this possible? - it essentially means that the ‘Data source’ for the repeating group is like a select, sum, group by. statement.

Thanks
Andrew

Does your User data type look like this?

User

• Name (text)
• Stationary (price)
• Travel (price)
• Accommodation (price)

If so, set your repeating group to type User. Source is a list of users. Inside the cell, have a text element with the following dynamic data expression: "Current cell User’s Name - Current cell User’s Stationary:sum Current cell User’s Travel :sum Current User’s Accommodation :sum :formatted as currency"

Does this work for you?

Gaby | Coaching Bubble

Hi Gabi,

No - its

CostEvent

• User
• Expense Type
• Value
• Date of expense

I need to be able to constrain the cost summary to a date range aswell

Let’s see… Try an RG that is type User: search for users.

The text in each cell should be search for cost event’s value :sum

The constraints for the text should be:
User = Current cell’s user
Date of expense [your desired operator] Date input (or wherever the date selection is being made)

Great - Gaby that did work, but now I am faced with the issue of trying to sort the result in descending order of the summed expense.

At the moment, I can sort the group by fields in the Users table.
There is an option to sort by a dynamic field, but I am unable to link the ‘sum’ calculation to the User.

Make sense? Maybe we need a ‘coaching bubble’ hour

1 Like

Hmm, yes, I’ll need to think about that one. I’ve still yet to crack the sorting of 1 data type by the fields of another. It always trips me up. I usually end up creating workarounds to pull the sort properly. If you want to share your link with me, I can play around with it with your test data so that I don’t miss anything for your use case.

(A session is cool too )