Combining data from two data types to calculate a total

Hey everyone, I’ve been frustrated with the following scenario for a few hours. I’m sure there is a simple way to do this, but somehow my brain isn’t functioning right now :slight_smile: Maybe someone has an idea.

Data Types:

  • Name
  • Hourly Rate

Timer Session

  • Seconds
  • Project
  1. A user has multiple projects with different hourly rates.
  2. A user has many timer sessions.

I want to calculate the total earned from all projects combined.
“Total earnerd from all projects: $xxxx.xx”

Is there an efficient way to get that total number?

Hi there, @semikolon… if I understand your post correctly, I might go with a total earned field on the Timer Session data type that I would keep updating with the latest total for the associated project. With that field in place, getting a user’s total earned for all of their projects would be a simple sum of the total earned field for all Timer Session things that have been created by the current user.

Hope this helps.


Hey Mike, thanks for responding!
That seems to be the only solution that makes sense.
It just adds quite a bit of housekeeping in cases where the users later edits the hourly rate of a project and I then need to update the total for each timer session, but seems to be the only logical way :slight_smile:

Well, you could probably calculate everything on the fly, but if it was me, I would much rather do the housekeeping and be done with it. :slight_smile:

1 Like

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