Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make SUM of Column value of all row up to current row in SSRS

I have webapplication having SSRS Reports...

I have a situation where i have to Update sum of particular field into last column for all above row up to current row..

for example..

ID    Balance    Total
----------------------
1     100        100      
2     200        300  
3      10        310
4    -100        210
5     200        410

In Above table, last column Total makes sum of value of Balance column of all above rows.. how can i achieve this ?

Thanks..

like image 560
ghanshyam.mirani Avatar asked Apr 02 '15 05:04

ghanshyam.mirani


People also ask

How do I sum a column in SSRS report?

In the tablix data region row group area, right-click a cell in the column group area for which you want totals, then point to Add Total, and click Before or After. A new column outside the current group is added to the data region, and then a default total is added for each numeric field in the column.

How do I use IIF in SSRS expression?

Value = “CA”, “Bold”, “Italic”) SSRS iif statement The format of the IIF() statement is as follows: =IIF(Expression, Condition set when the expression is true, Condition set when the expression is false) It should be a Boolean expression, according to parameter 1.

How do you sum distinct values in SSRS?

You use groups. At the top click the insert menu, then table, then Table Wizard. Pick your dataset and hit next. Now drag the column for the different types of items you want a distinct sum of into the Row Groups section.


1 Answers

You can use the RunningValue expression for this sort of thing, see:

RunningValue Function (Report Builder and SSRS)

This works for your data and example:

enter image description here

A simple table based on this:

enter image description here

The Total expression is:

=RunningValue(Fields!Balance.Value, Sum, Nothing)

Which gives the expected results:

enter image description here

Depending on your exact setup, you may need to change the Scope parameter to a Group or Dataset value, but Nothing works in the typical case.

like image 71
Ian Preston Avatar answered Sep 20 '22 16:09

Ian Preston