Monday, March 26, 2012

How do i just SUM the group header values?

Here's my table so far in RS:

Facility Name | Claim | Fee | Value | Payment | Table Header
Wisconsin West | | | | | Group1 Header
| 2356 | $45 | $23 | | Group2 Header
| | | | $21 | Details
| | | | $7 | Details
| | | | $16 | Details
| 2357 | $85 | $47 | | Group2 Header
| | | | $21 | Details
| | | | $9 | Details
| | | | $13 | Details
| 2358 | $105 | $65 | | Group2 Header
| | | | $35 | Details
| | | | $12 | Details
| | | | $20 | Details
Facility Totals | 3 | $705 | $405 | $154 | Group1 Footer

*Notes = Table and Group2 footers are hidden and contains nothing. The last column is detailing what level each line is and not actually part of the table.

I believe my issue is with the SUM function and how or where to place it. In the Payment field, the SUM function is adding correctly, but for the Fee and Value field, the SUM fuction is adding as if every line item in the payment field had the fee and value amount, hence the huge amount.

How can make the Fee field total to $235 (45+85+105) instead of $705 (45+45+45+85+85+85+105+105+105); the same goes for the Value field of $135 (23+47+65) instead of $405 (23+23+23+47+47+47+65+65+65).

Below are the expressions I have in place at the Group1 Footer for the Claim, Fee, Value, and Payment fields respectively:

=CountDistinct(Fields!ClaimNumber.Value

=Sum(Fields!dAmount.Value)

=Sum(Fields!Value.Value)

=Sum(Fields!cAmount.Value)

I've tried playing with the scope, but to no avail. Any ideas or maybe I'm doing it all wrong? It's almost as if I need a SumDistinct if such a thing exist.

In the meantime, I'm doing some serious researching. Thanks!

I'm sure this isn't the solution to your problem.

But it does have a sum distinct code sample.
http://msdn2.microsoft.com/en-us/library/bb395166.aspx

quite why they choose to embed the code samples as bitmaps is beyond me

I'm sure you can do something with IIF to fix it.

No comments:

Post a Comment