Showing the average number of days taken to complete a task for all users

Hi

In my user table I have the usual “date created” and also a new date field “date completed” which I fill with the current date/time when a user completes a task.

I’m writing some reporting functions on this data but can’t figure out how to output the average number of days taken to complete since they started(“date completed”-“date created”) across all users. Any ideas?

Thanks

Richard

Hi there, @richard16… if I understand your post correctly, I would likely have a separate field where I would store the number of days between the completed date and the created date, and I would populate that field when a task is completed. With that field in place, a simple average of the values in that field across all users should get you what you need.

Anyway, just food for thought, and I hope it helps.

Best…
Mike

1 Like

thanks @mikeloc . I was really trying to avoid adding another field in the user table that had the number of days but yes that could work. I really wanted to be able to just calculate it in the “search for” statement when displaying but couldn’t figure it out though it has been a long day!

1 Like

Like just about everything in Bubble, I’m sure there is more than one way to do it, and I’m guessing there is a way that doesn’t involve an extra field. That being said, I am never opposed to adding a field for something like what you are trying to do, as adding such a field will have just as many pros as cons, if there even are any of the latter.

1 Like

Yes, you’re right and there are pretty much always multiple ways to achieve the same result. In the end, I went with your idea of just adding a new field to the user table as it was a quick and easy solution and it made the search code super simple :+1: :joy:

Screenshot 2022-07-19 at 18.09.39

Thanks again :+1:

1 Like

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