IFF statement Sum works for the first part but not the second part
=IIF(Fields!Group.Value = "Test", Sum(Fields!clientCount.Value, "fiscalYearClientCount") - sum(Fields!yCount.Value), Sum(Fields!contactFY.Value, "contactFY") - sum(Fields!yCount.Value)) If the value is "Test" the x-y is correct. But if is not test the x-y is not correct. What am I doing wrong?
February 18th, 2012 3:53pm

Which one of these summing functions are bringing back a wrong number? Sum(Fields!contactFY.Value, "contactFY") - sum(Fields!yCount.Value
Free Windows Admin Tool Kit Click here and download it now
February 18th, 2012 6:16pm

HI, Your expression seems good check your value in "ContactFY" data set is it correct in query? Hope this will help you !!! Sanjeewan
February 19th, 2012 4:19am

Hi Diaz-Mayo, Please try to specify the scope in your expression. If scope is not specified, the current scope is used. For more information, please see: Using Built-in Report and Aggregate Functions in Expressions: http://msdn.microsoft.com/en-us/library/ms159673(v=sql.100).aspx Calculating Totals and Other Aggregates: http://msdn.microsoft.com/en-us/library/bb630415(v=sql.100).aspx Regards, Bin LongBin Long TechNet Community Support
Free Windows Admin Tool Kit Click here and download it now
February 21st, 2012 9:24am

The Sum is bringing in the wrong values. This line is returning the wrong numbers --- > sum(Fields!yCount.Value) The report looks something like this: Group 1 Header Group 2 Header Group 3 Header A = 1 B = 2 Group 3 Footer Total: 3 Group 3 A = 1 B = 0 Group 3 Footer Total = -1 <-- This is the problem
February 21st, 2012 12:28pm

My solution was to put "- sum(Fields!yCount.Value)" outside the IFF statement =IIF(Fields!Group.Value = "Test", Sum(Fields!clientCount.Value, "fiscalYearClientCount"), Sum(Fields!contactFY.Value, "contactFY")) - sum(Fields!yCount.Value)
Free Windows Admin Tool Kit Click here and download it now
February 21st, 2012 1:16pm

Hmm, that does seem strange...Without seeing the report, the only advise I can give is to keep playing with it - what happens if you do the summing for the false part of the argument outside of an IIF statement, does is sum as expected then? If that's the case, then you might need to play around with your IIF statement a little - enclose true/false in parentheses, idk... Try this outside of the IIF statement: =(Sum(Fields!contactFY.Value, "contactFY") - sum(Fields!yCount.Value) - does it sum as expected then?
February 21st, 2012 10:48pm

Hi Diaz-Mayo, Please try to specify the scope in your expression. If scope is not specified, the current scope is used. For more information, please see: Using Built-in Report and Aggregate Functions in Expressions: http://msdn.microsoft.com/en-us/library/ms159673(v=sql.100).aspx Calculating Totals and Other Aggregates: http://msdn.microsoft.com/en-us/library/bb630415(v=sql.100).aspx Regards, Bin LongBin Long TechNet Community Support
Free Windows Admin Tool Kit Click here and download it now
February 22nd, 2012 1:46am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics