[HELP] Calculating the average lifespan of a user, based on activity

Hello!

User’s on my app create a “session” object when they book recording sessions for a physical recording studio.

I’d like to measure the average customer lifespan. The equation is simple for each individual customer.
User's Session's Max - User's Session's Min : rounded down to month

My issue is aggregating that across all users.

I thought I could use “:group by…” to aggregate the data like this:

but since it’s a list, the mathematical equation operators don’t appear. Consequently I can’t add “- min of creation date”.

Any other thoughts on how to calculate this?

Thanks!

So you want to search for all Sessions, then for each one do Max (date) - Min (date):format as months, then take average of all those numbers?

Yes, although the sessions need to be grouped by the user who scheduled those sessions.

So right now you have your expression in a text element. If you put that same thing in a RG, the RG’s datatype can be “Grouping”

Then inside the cell you can do the calculation in a text element:

Maybe that’s what you’re looking to do? Then inside the cell you can have a button to take you to the Current cell’s Grouping’s Parent User like to their profile page.

Can’t rlly sort by the calculated value but you can display them…

You can do this calculation all in a text element if you just want like a list of texts, but I figured the RG would be more useful cause you can reference the User and stuff.

This would certainly start getting me some insight.
I’d love to still get an aggregated average, but maybe that just can’t be done yet with the options given me.

I’ve been reporting on this number so far by exporting the data into Google Sheets and doing basically the same equation over the course of multiple cells with filters I can change on the fly.

I was hoping to build my report into Bubble with more control, less clutter, better visualizations, and using live data - rather than having to export frequently.

I see, you have a main overview/report to look at.

If you have a RG for User, inside the cell you can basically figure out all of the data you want via a few searches per row.

AND you could actually frankenstein together an API call to your own app, your backend workflow does all the nested searches and returns data back as some new API datatype, each result with the text/number fields you’re looking for. Then you can do dynamic sorting based off of that.

( I kinda like that idea for your case NGL)

1 Like

Wasn’t there some SaaS that allows complex calculations in Bubble that was endorsed by Bubble? Wonder if anyone tried it :thinking:

@georgecollier Maybe u mean the WU Optimization video they put out months ago? The guy that had the photography app and needed to make lighter weight versions of his datatypes via the method i described

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