Adding subtotals

What is the most efficient way to add subtotals at the end of each group of data?

Hi @Paul_Brinkman :wave:

Welcome to the Parabola community! There are a handful of ways to do this, so it depends on the starting structure of your data + your desired output.

To start, I recommend using the Sum by Group step. If you sum a column without specifying a group, the column will be summed into a table with a single row. You can then use a Stack Tables step to add that subtotal to the bottom of the original table. This is great if you need a single subtotal.

If your table consists of multiple groups and you want to add a subtotal after each grouping, that’s also possible. It requires a few extra steps, but should dynamically format your data with subtotals.

Check out this example data I put together showing both subtotal and total rows inserted into the dataset:

This is what the step sequence looks like:

If you want to check out the logic behind that, simply copy and paste the text snippet below anywhere into your flow to duplicate my settings:

parabola:cb:4bbb0989-1a33-4a65-a654-d3d4e27ae9c0

Hope this helps!

@Paul_Brinkman are you hoping to do this on the final output of a flow? @daniel’s method definitely works, but I might suggest configuring this on “Tables” (so use a Send to Parabola table step and can configure subtotals/groupings quite easily). Happy to walk you through it, bump this thread if I can help.