Find Total Count of Each Type in a Column

I want to output a list showing the count of each type of Category in my Ledger table.

Table - Ledger
Field - CategoryName
(There’s other fields, but there not important for this situation).

Output I’m looking for example
Entertainment - 20 (There’s a total of 20 entries in the Ledger table where CategoryName is Entertainment)
Education - 4 (There’s a total of 4 entries in the Ledger table where CategoryName is Education)
Personal Care - 9
etc…

I’m having a hard time figuring this out. Any help would be very much appreciated.

Here’s an example from Stack Overflow where someone wants to do what I’m doing in SQL

I answered a similar question a while back with this example - https://bubble.io/page?type=page&name=groupbysum&id=louisforum&tab=tabs-1

Hope it heps.

1 Like

Hi,

One way you could this is:

  • You could do a “Search for” in a repeating group for categories
  • Then in the repeating group create a Text element inside a group of text type
  • Insert in the text part of the Text element a “Search for” on the table (thing) you want to total
  • In the conditional inside the “Search for” you will have a WHERE “whatever field” = parent’s group text* **
  • Complete you “Search for” with : count

parent’s group text could be the name of the category. If you are absolutely new to Bubble I would use the debugger so can see your values

There are others ways to accomplish this.

Hope that helps a bit,

Rick
Willing to help. Check my profile above.

1 Like

Louis, Thank you very much. That’s exactly what I needed. I used the Group By method.

1 Like