How do I calculate average with filter/condition (i.e. average ratings of last month)

Let’s say we have a collection that has ‘User’, ‘Date’, and ‘Ratings(number)’.

I figure out how to calculate the average ratings by the user.

However, I cannot calculate the average ratings of last month or last week by user.

Is there any way to do this with Adalo?

Hi @tommy1 ,

You can add filter for calculated fields such as count, sum, average etc, look for words like Add custom filter

Even nested filter in visibility.

1 Like

Thank you for your response, @Yongki

I noticed the filter function but cannot figure out how to filter by relative date

Can you demonstrate how you can calculate the average ratings of the last week or month by filtering function you mentioned?

Something like this,

Screen Shot 2022-02-13 at 10.44.11 AM

Thank you for your kind reply, @Yongki

But I still cannot achieve what I want to see.

What I want to do is filter by ‘Date’ that is specified by the user, instead of ‘Update Date’ which means when the record is created.

Let’s say I recorded the one week ago’s rating today, ‘Update Date’ is ‘today’, but the record has ‘Date’ property of ‘one week ago’, and I want to use ‘Date’ property to filter.

Is there a way to do this?

Hi @tommy1 ,

If that is the case, you would need to add another date field which is updated according to your own formula, you can add as many date fields as you need and update them before applying the filter.

2 Likes

Thank you @Yongki!

Partially solved. I found I should change the database structure simpler.
(Looks like the filter does not work as I wanted if three collections are involved.)

Understood what’s going on under Adalo.

1 Like