Press "Enter" to skip to content

Finding Row Totals in Powershell

Shane O’Neill needs a better data model:

Once you have the total per row, you throw in a SUM(that total) OVER () and you have a grand total. Thank you to Kevin Wilkie ( blog | twitter ) for re-igniting my curiosity about Window Functions again.

Click through to see a result in SQL Server and then trying to replicate it in Powershell. It’d be a lot easier, though, with a properly normalized data model which includes date, attempt number, and push-ups in that attempt. Pivot those results at the end if you want this sort of report, but SQL is designed to work best with tables in first normal form or higher.