Dynamic grouping and subtotals in Calc

I would like to have a spreadsheet with row grouping by date and group totals so that I can add new rows to existing groups and new groups, and the totals automatically adjusted. So far I found nothing on this. Unless I redo all subtotals every time I add new data, I can’t have the totals autoupdated.
Thanks
See example below:
First group:

Date Amount
04/01/25 20
04/01/25 30
04/01/25 40
Subtotal 90

Then I add 2nd group:

Date Amount
04/01/25 20
04/01/25 30
04/01/25 40
Subtotal 90

04/02/25 10
04/02/25 15
04/02/25 50
Subtotal 75

Then I add a new row to the 2nd group:

Date Amount
04/01/25 20
04/01/25 30
04/01/25 40
Subtotal 90

04/02/25 10
04/02/25 15
04/02/25 50
04/02/25 30
Subtotal 105

Try again?

But what I really suggest is to use a structure, which takes advantage of Calc instead of doing the work yourself:
Instead of isolated areas just use one table with
date | value
.
With a continous table you could

  • add a pivot table to get your details and more
  • you could filter a range to other areas to sum it there
  • If you wish to have the subtotals in the table I suggest to “waste” a column for the running totals and put a formula in the third column C2
    = IF (A2=A1; C1+A2; A2) and drag this down. The problem to solve now is showing only the subtotal at the end of the day. You could use conditional formatting or use the fourth colum (remember: columns are “cheap” in Calc) with a similiar formula in D2
    = IF (A2=A3; ""; C2 ) and hide the complete column C after dragging down this formula. The decoration/inscription “Subtotal” I would put in the format of the D-column then. This will show the text, but leaves the cell numeric.

Calc can expand ranges in formulas, but often fails to detect your change. Assume a =SUM( A1:A10) and go to row 5. Now insert a row above or below row 5 and the range in your sum should adapt to A1:A11
.
The typical problem is: You will add something below your range, not inside. This will not cause the range to extend.
.
The thread I linked above in my comment shows a work-around: Create a boundary, wich you can include in the range and wich guides you to insert inside the range.
I would use an empty row 11 below my range A1:A10 and expand myself the sum to =SUM( A1:A11) Now make the row smaller (perhaps 1/4th of other row height) or fill it with a text like ______
When you add rows above this marker the range of the sum will expand.
Check also the setting to expand ranges mentioned in the linked thread.
.
As you still need to adapt this for every “day” in your setup, I recommend not to use this “solution” but to use a better way to organize data, as I’ve mentioned in my comment.