Sometimes I receive questions from readers that make it to a new posting.

The other day I received a question about a modification to an earlier post about SSRS and running totals.

This reader wanted a running total in the footer of the page AND a running total in the body of the page, at the start to be exact.

I got this example (the right one was the one requested)

20170613152832

So I start with a basic table with some values and the query used in the dataset.

 

01Table02Qry

A simple table and page header / footer.

 

03Design01

Preview looks good.

04Page1-2Design01

But now for the two running totals. 

The first one (at the bottom) is simple.
I just create a new column (that will be hidden in the real report) and add an expression in the rows.
=RunningValue(Fields!Value.Value,Sum,”table1″)

I named the textbox HiddenRunning and referred to it in the footer like so:

=”Footer text with running total : ” + cstr(ReportItems!HiddenRunning.Value)

05Design02

Now this should give me a footer with some text and the running total.

Next the running total at the start of the body.
Now this seems more difficult, but it is actually simple as well.
I created a second column and added an expression in the row.

=RunningValue(Fields!Value.Value,Sum,”table1″) – Fields!Value.Value

Looks similar right? The only addition is the subtraction of the value from the first item. So this should give me a running total from the previous page(s).
I named the textbox HiddenRunningTotalMinus1Row.

Now you can refer to it somewhere else in the body (just make sure it is above the first row).

=ReportItems!HiddenRunningTotalMinus1Row.Value

And look at the preview:

06Page1-2Design02

Looks a lot like the request.

2 Comments

  1. Hello,
    this is exactly what i need
    i have created all required fields, but =ReportItems!HiddenRunningTotalMinus1Row.Value
    always send me 0 when i place it in the tablix header or first row

    do you know where is the matter, please?

    1. Author

      I’m sorry, that is very hard to judge without having built the report myself.
      My best advice is to start very simple and see if you get it working that way.

Leave a Reply to admin Cancel reply

Your email address will not be published.