Adding up Database Values -

I’ve searched and googled and I’ve been stuck on this. I want to display the total dollar amount of input values on a dashboard page.

I have input fields that allow a user to save “budget” category amounts. I want to display the totals of those fields on a dashboard. It seems like a lot of repetitive and searching the database for each field.

This is specific to a user, and I want to only display the totals of certain “database items,” i.e. housing + food + clothing = $xxxx. I know this seems basic but right now I am displaying each through text and dynamic expressions but I then want to add those dynamic expressions together. I can’t seem to make it work without manually adding in each category referencing the “created by = current user”. There has to be more simpler way. Thanks!

Good morning @myrealgoals!
Is this result in a table or repeat group? Could you send a print of how this part is?

Right now I am displaying a total in a group through an expression. But I want to use this total on a different page (ie. dashboard). I also want to manipulate this data further. I hope this makes sense. The values of the inputs are database fields…if that helps.

Do you want something like this on your dashboard? I like to recreate the help request and sometimes it can take a while, here is a print of the idea, if so of course!


Hi! I am looking for something like this. The amounts of the sum are “data fields” from the same data type.

it would be something like this

Is this like a hidden repeating group? I don’t understand.

There is nothing hidden, the first table (repeating group is a repeating group, where it calculates individually, the table where the general total of expenses separated by product is (let’s say so) is a normal group (group).

Thanks! I appreciate the effort, but I don’t want any of the subtotaled items showing.

I want the dashboard “groups” to only reflect the totals, as I showed in the prior image


! I appreciate the reply but it really doesn’t answer what I am looking for. I want a dashboard to display subtotaled items of a database. Then I want to be able to add those subtotals together to display an additional amount.

Ok, success in your project !

Bump this as I’m interested to know the most EFFICIENT and less WU as possible way of doing this. If he has 20 dashboard stats that would be 20 searches per page load, that would kill us on WU and that’s not the most efficient way.

What is the most efficient way guys? Saving it to the current user would be. Wouldn’t it?

I’d imagine you’d have to make a change to current users List of DataType every time you create a new X in dataType. For example Business Expenses is a dataType but you’d also have “List of Business Expenses” under current user. Every time you create a new business expense you make a change to current users lift of business expenses = add this business expense.

That way you can reference “Current Users Business Expenses” and that’s the most efficient way of doing it to minimise Wu as current user is loaded once client side and cached to use so it’s significantly quicker and cheaper on WU. That’s my understanding

It depends how often your data is being updated. If your data is rarely changing, then sure, cache it if you really want to (and increase the complexity of your app and make it less maintainable). But you won’t be able to, for example, display stats for a custom time range, as all you have is a number.

A dashboard with 20 stats isn’t a dashboard, it’s a report. Keep a few key KPIs on the dashboard. You can hide others in a group with a click, for example.

Not sure if I’m reading your question right…

but are you wanting to show the total of all 3 groups?

Something like this:

If so, for the ‘Grand Total’ group I just added a text element with the following:

You would of course change the expression to fit your use case.

Not sure if this is what you’re looking for, but if it is I hope it helps.

So if you’re counting and a number is updating regularly, putting it in current user isn’t actually ideal at all?

Thank you!! YES, I finally figured out that I needed to create a new field and subtotal those expenses prior to display. I was trying to accomplish this sub-totalling in the text, which was a lot of recall. Now, I am trying to manipulate those numbers to display on the dashboard…I appreciate the reply~

1 Like

Not at all. As the ratio of updates to reads increases (more updates for each read), it becomes less efficient.

Sounds like you’re building an expense-tracking app which I’m sure has a lot of calculations.

My first app had a lot of complicated calculations and it took me days to figure them out.

I discovered a lot depends on how you have your data base set up.

Also, perlexity.ai helped me a lot trying to figure out how Bubble does calculations.

You can use it for free and ask it to guide you. It does go off the rails at times and you have to remind it you’re talking about Bubble.io.

It helped me a lot, although it was still frustrating.

Good luck on your app. I’m sure you’ll do good with it.

If you have any more questions I’m sure someone on the forum probably has an answer.

1 Like