I am creating a report and trying to Get a Sum combining values from multiple tables and can't figure it out and am beginning to wonder if it is even possible?
I have 2 stored procedures returning the same data with different time frame. One stored procedure is returning data based of Amounts in the past 12 months. The other procedure is returning sum of all Amounts for 13+ months. I have a sum for both to get the total collected for 1 year and total for 1 year+. I want to combine these total to get total for all years. The problem I am facing is totals are grouped by classification and name.
I have the following example data:
Date Class Name Earned Count Earned Amount Collected Count Collected Amount
Sept-11 Red Jack 5 10.50 2 54.20
Sept-11 Red Bill 2 22.75 4 120.58
Sept-11 Blue Jill 9 43.23 25 443.32
Sept-11 Green Bob 84 45846.33 62 4843.22
Sept-11 Green Pam 2 13.55 1 23.23
Sept-11 Green Tammy 32 2332.22 443 33232.33
Aug-11 Red Jack 1 23.50 2 33.20
Aug-11 Red Bill 2 52.75 4 323.22
Aug-11 Blue Jill 3 43.23 23 33.32
Aug-11 Green Bob 4 46.33 22 653.22
Aug-11 Green Pam 5 13.55 1 46.23
Aug-11 Green Tammy 6 1132.22 111 89.33
Totals Looks Like the following:
Date Class Name Earned Count Earned Amount Collected Count Collected Amount
Sub-Total Red Jack 33 ##.## ## ##.##
Bill ## ##.## ## ##.##
Blue Jill ## ##.## ## ##.##
Green Bob ## ##.## ## ##.##
Pam ## ##.## ## ##.##
Tammy ## ##.## ## ##.##
Year+ Red Jack 4344 ##.## ## ##.##
Bill ## ##.## ## ##.##
Blue Jill ## ##.## ## ##.##
Green Bob ## ##.## ## ##.##
Pam ## ##.## ## ##.##
Tammy ## ##.## ## ##.##
So I want to combine Year+ total to year total for each class and name. For example, I want to find Jack's Earned Count for a year and year+ so it would be 33 + 4344, except in reality I want to do this for everyone for all values listed.
In SSRS, I have grouped by class and name and have totals for year+ and I am trying to add the sum from year but It only gets the total for everyone and not just for one person and their class. I am using the following expression for one field:
=Fields!EarnedCount.Value + Sum(Fields!EarnedCount.Value, "MyEmployeeRpt")
Is there a way to take a sum based on a value like only get the Sum when Name = Bill and Class = Red. Another issue I am facing is that I don't know how many names or classes I might have. Any thoughts? Thanks for the help!