Adding a sum column
Add a column to a table that sums all of the numerical cells in the same row. Useful for tabulating sales numbers or creating a balance sheet.
Itemized data can be difficult to use without a total to reference. If you have a table of sales numbers per quarter of per representative, a total column can help make the data more usable.
In Excel, you would need to create a formula and apply it across an entire column, which can be time consuming if you have multiple data sets or need to do it periodically as new data comes in. In SQL you could use a PIVOT and a GROUP BY.
We will use a common data manipulation pattern that creates a single column of all values, operates over those values, and then returns them to the original data. Use a Row Number Object to add temporary ID's to each row, and then use the Unpivot Object to move all of the relevant data columns into a single column. Now that all the values to be summed are in a single column, the Group By object can group by the temporary ID and sum all of the values which correspond to that ID. Then we add the new sum column by performing a Join with the original data, matching by temporary ID.