RunningValue to SUM group totals.
The following seems simple enough but I just can't think of a way to do it at the moment.
My dataset is like this:
CustomerID, CustomerAnnualTarget, Year, Month, MonthlyActual
1, 50000, 2011, January, 3000
1, 50000, 2011, February, 8000
2, 75000, 2011, January, 10000
2, 75000, 2011, February, 8000
Has you can see there are 2 customers with annual targets of 50,000 and 75,000 respectively... and so far in 2011 they have recorded actuals of 11,000 and 18,000 respectively.
I am displaying the above in SSRS via a Table with a Group for Customers so it appears like this:
Group1 - Customer: 1 Target: 50,000 Actual: 11,000
Detail - January 3,000
Detail - February 8,000
Group1 - Customer: 2 Target: 75,000 Actual: 18,000
Detail - January 10,000
Detail - February 8,000
What I am trying to do now is display report totals like:
# Customers = 2
using expression: =COUNTDISTINCT(Fields!CustID.Value,"DataSet1")
Total Target = 125,000
using expression: ????
YTD Actual = 29,000
using expression: =SUM(Fields!MonthlyActual.Value,"DataSet1")
I am not sure on how to SUM the Total Target so that it only includes it once for each customer... I tried the RunningTotal() but without success.
All help appreciated.
February 18th, 2011 11:37pm
Try using the FIRST function. Since the value will be the same for every row in the customer group, it shouldn't matter which row you get the value from; FIRST() or LAST().Paul Turley, MVP [Hitachi Consulting] SQLServerBIBlog.com *Please vote if helpful*
Free Windows Admin Tool Kit Click here and download it now
February 19th, 2011 12:37am