Search for unique elements of nested elements

Good morning,

Here is a tricky one :sweat_smile::

So I have this scenario:
Data type 1: Expenses
Data type 2: Expense_line items connected to the Expense
Data type 3: Expense_line_category connected to the Expense_line

So on each Expense, we have Expense_line items and those Expense_line items have associated one Expense_line_category

I need to somehow show in a RG how many Expenses has in their Expense_line items associated a particular Expense_line_category (this categories are filtered by a field such as “category group = finance” for example).

Something like this:

For example, in the RG I´ll show to the user "You have 8 expenses with the expense category «Cost of Goods».

So I´m guessing I´ll need to use the “:unique elements” expression but I´ve done quite tests and I don´t know how to get where I want.

I´m hoping anyone can help with this since I´ve seeing is super tricky for me :frowning:

Maybe @vini_brito @johnny @NigelG @Jici can point us in the right direction?

Thanks a lot to all and have a good day :slight_smile: .


search for line items grouped by expense category with count aggregation

Hello @cmarchan,

Thanks man, but I need to count the number of expenses that contains line items with specific category.

How would that go?

Hey @cmarchan

I´ve achieved to do the search as you said with grouping but I don´t see how can I achieve to group by the number of expense which lines contains that specific category.

Thanks a lot.

Hey there,

Can anyone point me into the right direction?

I´m trying “search for” combined with “unique elements”, “group by”, “format as text”, etc. but nothing.

Thanks a lot to all.