error when using the sum function
Hi, I am using SSRS 2005 and when I use the following expression it works perfectly at the group footer level but not at the page footer level. =Sum((iif(Fields!Freight.Value = "PREPAID", Fields!C_Cost_FrtPpd.Value,Fields!C_Cost.Value))) The error is: [rsAggregateOfMixedDataTypes] The Value expression for the textbox textbox55 uses an aggregate function on data of varying data types. Aggregate functions other than First, Last, Previous, Count, and CountDistinct can only aggregate data of a single data type. Preview complete -- 0 errors, 1 warnings I have tried the CDbl, CDec, and CInt to try to convert the data but I am just not sure which part of the expression is incorrect. But it works perfectly at the group footer level. eg =Sum((iif(Fields!Freight.Value = "PREPAID", CDbl(Fields!C_Cost_FrtPpd.Value),CDbl(Fields!C_Cost.Value)))) What am I missing? Any help would be appriceiated. Thank you Blair
October 20th, 2010 9:40pm

Hi Blair You could try placing the iif outside like so =iif(Fields!Freight.Value = "PREPAID",Sum(CDbl(Fields!C_Cost_FrtPpd.Value)), Sum(CDbl(Fields!C_Cost.Value)))
Free Windows Admin Tool Kit Click here and download it now
October 21st, 2010 4:54am

This: =Sum((iif(Fields!Freight.Value = "PREPAID", CDbl(Fields!C_Cost_FrtPpd.Value),CDbl(Fields!C_Cost.Value)))) Should be fine - do you get the same error message when you put that in the page footer? I'd be surprised if you do as the footer is data set exclusive so I would expect you to need to add teh dataset reference to each field specified... =Sum((iif(Fields!Freight.Value = "PREPAID", CDbl(Fields!C_Cost_FrtPpd.Value, "DataSetName"),CDbl(Fields!C_Cost.Value "DataSetName"))))Rgds Geoff
October 21st, 2010 5:22am

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

Other recent topics Other recent topics