Question

I'm creating a RDL and I'm trying to sum hours. The source data type is (numeric(11,4),null). The expression I'm trying to use is:

      =sum(iif(Fields!cal_variance.value > 0, Fields!cal_variance.value,0))

I have also tried:

      =sum(iif(Cdbl(Fields!cal_variance.value) > 0, Cdbl(Fields!cal_variance.value),0))

I still get the same error:

"The Value expression for the textbox ‘textbox19’ 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 should also mention that the column "cal_variance" is a derived column:

       =IIF((Fields!COMMENT.Value) = "DC01 MONTHLY - GROCERY CHECKING" 
OR (Fields!COMMENT.Value) = "DC01 MONTHLY - DAIRY CHECKING"
OR (Fields!COMMENT.Value) = "DC01 MONTHLY - PRODUCE CHECKING"
OR (Fields!COMMENT.Value) = "DC01 MONTHLY - MEAT CHECKING"
OR (Fields!COMMENT.Value) = "DC01 MONTHLY - FROZEN CHECKING"
OR (Fields!COMMENT.Value) = "DC01 MONTHLY - FRESH PUTAWAY",
     Fields!cal_amount.Value / 9, Fields!cal_stdtime.Value - Fields!cal_actualtime.Value)

Any help is greatly appreciated!

Was it helpful?

Solution

If the underlying field is numeric, you will need to make sure both sides of the IIf are decimal in the SSRS expression:

=Sum(IIf(Fields!cal_variance.value > 0, Fields!cal_variance.value, CDec(0)))

Your second example above fails as you are aggregating a double with an integer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top