SSRS - Sum fields that are in group rows - a custom RUNNING TOTAL excercise

* This article, and all our great SQL (General) documentation, Is available on the SQL (General) menu

Here's the problem: You are writing an SSRS report and you want to sum a value that is in a group header. In Crystal we would do this using a running total field. (sigh)

In the image below, we're written a SOP report and we want to sum the DOCAMNT field. If we just do that, we get a number that is way too big, because it sums for each line in the order. The SSRS way to fix this is to use variables; but that approach is so inelegant.