In SSRS, how do I compare a value of a parent report item with report items in a child group?

Brandon Tull picture Brandon Tull · Sep 4, 2013 · Viewed 8.1k times · Source

I am using SSRS 2008. I have 3 different groups above my report details that are calculated sums. I am trying to color the limit red if any of the invoice sums(A) in a child group is above the limit(B).

I am currently using this expression, but it is only looking at the first or last invoice amount. The limit report item is in a parent group just above the invoice's group.

=IIF(ReportItems!Invoice_DueDate.Value>ReportItems!Limit.Value,"Red","Black")

enter image description here

My Solution: I decided to use SQL to get the sum of the invoice amount grouped by due date. I then called that field in the parent group.

Answer

Jamie F picture Jamie F · Sep 5, 2013

If I understand your question correctly, then I think you can use

=IIF(MAX(ReportItems!Invoice_DueDate.Value) > ReportItems!Limit.Value,"Red","Black")

You need some sort of aggregate function, such as MAX() to tell SSRS what the scope and operation of what should be done. (For example if you wanted to make sure the total didn't exceed the limit, you would use SUM(...)