Count occurrences within data

Hi,

I have a table “Bank” that contains rows for each companies’s banks (company is an other data type). Some companies have only one line (because they have only 1 bank) and other companies have X lines because they have X banks.
I would like to calculate how many companies have 1 bank, how many have 2 banks etc.
Can’t find out how can I do that. Tried with group by and filtered so far without success.
Thanks a lot for your help

I believe you are either in need of the operator :count which would normally be used after a search to know how many results of the search there are.

If you are not looking for that, you may be in search of the :group by operator which is normally used to take a set of data and group them by some data field.

Hi there, @Yacasu… if I understand your post correctly, a repeating group with this data source should do the trick.

Hope this helps.

Best…
Mike

Thanks a lot for your reply!

And how do you display it in the RG ?
IE :
Company with 1 bank : X
Company with 2 banks : Y
Company with 3 banks : Z
etc.

Oh, wait… I think I misunderstood pretty much everything here. :slight_smile:

If I understand correctly now (which still might not be the case), I wouldn’t create a new thing in the bank data type for each bank/company combination. Rather, a bank should be its own thing, and you could have a field on the Company data type that stores a list of banks for the company. With that field in place, it would be easy to get a count of company’s that only have a certain number of banks by counting the number of items in each company’s bank list field.

Thanks boston & Mike for your replies.

That’s clearly the easiest way to do it! Thanks a lot

1 Like

Well, it appears to be more complicated than expected.

Even with this export, I can’t access the number of item in the field’s list. How do you do that @mikeloc ?

I guess it is a bit more complicated than I made it seem. Here is an example of an advanced filter that does a count of the companies with 1 bank.

1 Like

Thanks a lot Mike!

1 Like

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