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.

To calculate the Running Total in SSRS, 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. Please check the report review.

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. 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")

Click OK to close the expression window and check the final report for any other formatting changes. 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