I am working on a report where I have an expression that gets the Max value of a field in the detail row of my report. I have four levels of grouping that I then need this expression to sum. The expression is:
=Max(IIF(LEFT(Fields!JobNum.Value,1)="S" AND Fields!Week1STol.Value<>0, CDBL(Fields!Week1STol.Value), 0))
I am using Max, because I need a value from a result set that is one of the non-zero values from the result set. They will all be the same, or 0, so if there is a different way to get the non-zero value without using an aggregate I can change my expression to do that, but I have not found a way to do that yet. Now since I am grouping this, and as each group rolls up I need the sum of the max values in the subgroup. When I get is the Max value of the new group.
I have tried various ways to try and get this to sum. I have tried creating total rows, added custom code to collect running totals, etc., I have also tried wrapping the whole thing in a SUM aggregate, and that will work in the detail, but will not roll up into the groupings.
Any help as to how this can be done will be greatly appreciated.
Thank you,
Chad