Calculate the Running Total in SSRS

This SSRS article shows how to calculate the running Total for a table report using a RunningValue function with an example. It is one of the important interview questions one might face.

First, right-click on the Datasets folder to create a new DataSet. The below screenshot shows the data set that we use for this example.


The Sql query that we used above SSRS example is:

SELECT * FROM Employee

We have designed a simple table report of Employee sales and formatted the font and colors.

Table Report

Let me show the report review.

Table Report Preview

Calculate the Running Total in SSRS

Right-click on the sales column, choose the insert column, and then select the right option to create a new column on the right side of the sales.

Add a New Column to a Table

Name the header field Running Total. Next, right-click on the below empty cell and choose an expression to calculate the running Total.

Name Header for Calculate Running Total in SSRS

The SSRS reporting service has a RunningValue function to calculate the running Total, which accepts a numeric column, an aggregate function, and the dataset name. Here, we have chosen the sum aggregate function to find the Total or sum.

Expression to Calculate the Running Total in SSRS

Write the below expression.

=RunningValue(Fields!Sales.Value, sum, "EmpDs")

And the final report is.

Calculate the Running Total in SSRS Table Report

If you go to the report preview now, you can see the running Total from table top to down.

Calculate the Running Total in SSRS Table Report Preview