Can this all be achieved in just the dashboard?
Yes, with month as a table chart's dimension and the expression being something like the following:
..... the above() function looks at the next row up
This can also be done in the script, by reloading the transaction table into a smaller summary table (or even as rows within the same table) and applying a Group By clause.
I would advise doing in the charts though as grouping in the script means you lose the ability to see results at a finer level of granularity, unless you allow for the possible dimensions in the group by clause.