How can you do something similar on a report?
Still discussing about this...you may also try a query like this, notice it depends on the order set by the SalesPersonID to work correctly:
SELECT C.FirstName, SP.Bonus,
RunningTotal = (SELECT SUM(B.Bonus) FROM Sales.SalesPerson B WHERE B.SalesPersonID <= sp="" salespersonid="" p="">
FROM Sales.SalesPerson SP
INNER JOIN HumanResources.Employee E ON E.EmployeeID = SP.SalesPersonID
INNER JOIN Person.Contact C ON C.ContactID = E.ContactID
ORDER BY SalesPersonID
Hi Jason,
I see what you are saying, unfortunately for the moment there is no way to reference data within the table using expressions, so I would recomend you calculating the running_totals and loading them as part of the Data Source, either a DB View/Store_Procedure or Object Data Source would work. This way values are calculated and loaded as another DS field and you would just need a label to display it in a table. Personally, I would go for the second option (ODS) for not relying on DB procedures, retrieving data from the DB and programmatically calculating and setting running_totals for each row (employee in your case), here is a quick guide to see how you can create one. How to Bind a Report to an Object Data Source.
Hope it helps. Regards,
Miguel.
The link doesn't help. I need to calculate exactly like the example I gave. How would you do that in a expression?
Name and Sales would come from the database. I need to calculate Running Totals.
It really depends on how data is retrieved, for instance you can load those "Running_Totals" from the DB or calculate them using expressions. May I suggest you taking a look at the following document to see if it covers what you are trying to achieve?
Creating an Invoice Report
Please let us know how it goes.
Regards,