Subtotals inside a repeater

Guys, I need to display a list of sales between 2 dates. Using a repeater. Now I want an optional sub-total of sales per month within those 2 dates.
Example
Start : Jan 1, 2021
End : April 30, 2021
What to display? Every sale with a subtotal per month (so Jan/Feb/MArch/April) and a grand total all the way at the bottom.

The question:
How would I approach this. I see 2 possibilities:
a)before throwing .data to repeater, loop thru the array, calc subtotals/total and insert a row into the array per subtotal
b)put a second, collapsed box inside repeater (underneath the box which displays sales per date). Calculate (sub)total per row and always fill this box with (sub)totals. If end_of_month, expand it.

Curious what the best approach (or any other) would be.

Love answering my own questions: I eventually went for b. I also wanted lines above the (sub)totals and then you should do that on interface level, not data.

Hi Giri Zano! What’s the best way to connect with you to see if I can hire you for a project?

Also, give some information, what you are talking about :wink:
https://www.wix.com/velo/forum/coding-with-velo/booking-multiple-services

Hey Don, I normally do not work as a hired gun, but drop me an email at

giriscodecorner@gmail.com

and let me know what you want. Maybe I can help you.

And for everyone else who thinks “Hey, that’s handy, his email”, don’t. It’s temporary address number “too many” and I drop them faster than you can write (when bothered with Wix problems/spammed).