Sign Up Now! Log In
Esther 9/11/2013 9:39:01 AM

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.

What we really want is in the DOCAMNT2 column:

Here's a technique that makes this very simple

Version: Unknown or N/A
Section: SQL Scripts