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.
SELECT * FROM Employee
We have designed a simple table report of Employee sales and formatted the font and colors.
Let me show 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.
- Please refer to Calculate Running Total in Grouped Report.
Name the header field Running Total. Next, right-click on the below empty cell and choose an expression to calculate the running Total.
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.
Write the below expression.
=RunningValue(Fields!Sales.Value, sum, "EmpDs")
And the final report is.
If you go to the report preview now, you can see the running Total from table top to down.