Create a list that gives me the count for each unique elements of a list of numbers

Hi

I have a list of bottles of wine. Each bottle has a vintage (number) and a minimum aging potential (number). For example a 2020 red burgundy wine that has 10 years minimum of aging potential.

I would like to find a solution for the following thing : calculate the sum between the vintage and the aging potential (it gives me the year in which I should start thinking about drinking it) and then calculate the count of occurrences for similar years calculated this way. Maybe 20 bottles in 2024, 32 in 2025, 3 in 2026 and so on.

Ideally I would love a solution that does not force me to write this first calculation in the database (less work) but maybe it is the only solution.

I am completely stuck. Could someone please help me?
Thanks a lot

Cheers
Edouard

Probably an additional field with that calculation would be the way to go. This can be done by setting up a database trigger so if any of the two fields change then recalculate.

Then you can use :grouped by to get the counts for each year

I tried slicing it in a way where you didn’t need the separated calculated field but Bubble wasn’t cooperating :joy:

Thanks a lot for your help.

So it goes back to what I thought : I have to create an additional data for my bottles. At least I am sure that it’ll work :smiley:

Have a great day