Home » SQL Server

error when using the sum function


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.

=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



<< Previous      Next >>

Microsoft   |   Windows   |   Visual Studio   |   Sharepoint   |   Azure