[New Feature] Grouping and Aggregating Data

Are you trying to achieve something like this:
Screen Shot 2020-04-07 at 12.39.07 PM

This is how I did it:

Use this plug in:

I did the claculation for the value of the progress bar directly in the value:
Screen Shot 2020-04-07 at 12.42.33 PM

1 Like

Is there a reason “location” isn’t included as a field you can group by? I would love to use this to group and aggregate map markers to prevent duplicates.

I have put the chart into a repeating group to get a chart for each variety that is in the list. Starting and end point of the chart is a date pick field outside the Repeating Group, grouped by year-quartal that is in the list for each item.

That works fine: all charts starts and ends on the same dates:

BUT the problem is that not al the year-quartal is shown in all charts like the chart in the middle.
What can I do to have all 3 charts X-as looks like the chart in the middle?

thanks for helping!

Is it possible to access the individual data within the group?

I second this!

This is a great feature! I’ve been working in Business Intelligence before Bubble and I was hoping that Bubble would allow me to aggregate and group data in this way (without an external database and a SQL query).

@josh The :group by feature integrates very nicely with the line chart example you showed in your post, using Bubble’s “Chart Element” plugin. However, if I wanted to do a stacked line chart (e.g. last year as one line, this year as one line) - what is the best way to do that? I note the current Chart Element plugin only allows one series. I’m trying out some 3rd party plugins but they don’t seem to integrate with :group by clause as nicely as the Bubble plugin does.

Hi @Bubble ,

Would it be possible to use this feature as a list for “plugin actions” and “schedule things on a list”? I am not sure if there is any limitation behind that but for some reason “groupings” are only allowed in RG or list within elements, not actions or to schedule api workflows on “grouping lists”

Hello! Is there a particular use-case you’re trying to set up with this? Groupings are essentially purely visual, and therefore only available for front-end elements: for backend, you should expect to use constraints instead of groupings.

Hi @eve,

I do not really need this to work on the backend, even actions on client side elements do not allow that. In any case, my use case is the following:

  • I have a TIMESHEET data type for users to log their working hours.
  • I would like to generate a monthly invoice with all hours registered by each user per day (there could be 1, 2, 3, o more logs per day per user).

For that I have a backend workflow with the following inputs:

  • Date (type date)
  • Hours registered (type number)
  • Users (type user)

This backend workflow uses these inputs to generate a line item in the invoice. So if I could schedule an API workflow on a list, which would be "do a seach for TIMESHEET’s: grouped by date, user (aggregating the amount of hours registered per TIMESHEET) that would create the 3 inputs (date, number and user) that I need for the backend workflow.


(grouping not allowed client side)

This is my particular use case, but I could see that being useful in other circumstances. And as you can see, I do not use at all the “grouping” on the backend, it is just to generate the inputs for the “schedule api workflow on a list” action triggered client side.

As mentioned – you’d be looking to use search constraints for this. If each of your Timesheets has a Date, you can search for all Timesheets’s Unique Dates, and use that to set up a grouping-like expression to have all Timesheets for each unique Date grouped together. Again, “grouping” as in the expression for chart renders is basically just a front-end shortcut for this kind of expression, but it’s definitely something you can set up through other Bubble terms.

I understand but that would not work, because I can only use the :unique elements with either a date or a user, not both. The only workaround available that I am aware of is to use the “schedule an api wordflow on a list” with a list like “do a seach for… 's date :unique elements”, and then inside that endpoint do another “schedule api worflow on a list” with a list like “do a seach for… 's user :unique elements”. But that takes so long that it is not acceptable in terms on usability.

In any case, just remind it could be handy if you ever review this functionality. I use groupings as inputs in many plugin elements to do all kind of calculations, and they are very handy. So thank you for this great functionality! Also thanks for replying back!

1 Like

Hi all! Two quick questions on grouping/aggregating data, both related to performing calculations on individual elements within a grouping. For this example, all you need to know is that we have users who go through onboarding.

Question 1—comparisons to a previous period:
I want to make a chart with all new user sign ups by month or week. I also want to show the percentage increase from a previous period (WoW/MoM/YoY), a pretty standard BI thing. Any idea how that might work with this grouping feature?

Question 2—calculate something within a grouping:
I’m imagining three charts:

  1. New user sign ups (by month or week)
  2. New user sign ups who completed onboarding (by month or week)
  3. Percentage of users who completed onboarding (by month or week)

1 and 2 are straightforward with this grouping feature. How would I create number 3? I can’t seem to do a calculation off a ‘list of numbers’ - but theoretically, if I had two lists of numbers, I would think I could do some kind of operation on both lists, that would result in a 3rd list. Is this possible?

Hey @eve

Am I right in thinking that you are saying you can run a search and group the results within that search?

I’m finding the :group_by modifier to be pretty slow and I’d love to be able to speed up the search/grouping on the backend so that the frontend is only presented with the grouped search results.

How could this be achieved? :pray:

I want to use the plugin to plot individual values of temperature grouped by time the temperatures were recorded. I can’t seem to be able to do that. Is the plugin capable of doing that? If yes, can you help with a demo?

Did you find a way to avoid multiple searches in this situation?

Hi There everyone.

I have been able to really utliize the grouping and aggregating function but i notice that in situations where im gouping by multiple values, i get nulls or blanks in my display. The Nulls shouldn’t appear since there are no records.

Is there anyway i can group with getting NUlls?

Hi all, I see that this might have been asked before but I can’t see yet an answer for it.

We want to be able to see the timestamp of specific events as they throughout the day. All the events have a date and a time - yet we can’t work out how to have hours of the day on the x axis. If this was by day or week or month it is easy as you can group by intervals and tick to include blank groups.

Has anyone solved this?

@josh

i want to perform this grouping using username initials.

But option i’m getting is for exact name. I want to group users with username’s first alphabets.
How can i do that?

Quick and simple workaround would be to have a text data-field on the user called initial. You can then group by the exact initial.

@nico.dicagno
Thank you for your quick response.
Getting this users list from API reponse. And this list comes in ascending format. I’m udinh User object for this. Without having a field, will I be able to achieve this?