Hello, I'm a total SQL beginner, learning fast but needing some help with a report I'm creating.
The report is for a job ledger and the SQL table includes JobNo, Date, CostCode, TotalCost amongst others. I created a dataset with the mentioned headers between two dates and a job number specified by the user. Then in the Layout section very cleverly entered the data into a table grouped by the cost code, added some totals and was feeling very pleased with myself and my first 'real' report.
Now the FD wants the same table to include the total costs for each cost code BEFORE the specified start date. ie the "before total" next to the "specified date total" for each cost code then added together to give a running total for the total cost for that code.
I have created another dataset (called RunningCost) from the same SQL table to include the costs from the beginning of time (20010101) to the start date given by the user. And I have created another table in Layout, again grouped by the cost code. The results I get out from this table are exactly what I want. The problem is I cannot get this info into the first table.
I can drop in:
=Sum(Fields!TotalCost.Valu
e, "RunningCost")
to the first table within the group structure, but this does not give the total for each cost code, only puts in the complete total for everything previous at the end of each cost code section.
Is there any way of adding the data to the first table so it is also filtered by the groups or can you combine the 2 datasets into one in such a way that would allow me to create the desired results.
Many thanks for any help in advance,
John
Start Free Trial