[rsAggregateOfMixedDataTypes] Warning

  • I'm just starting with SSRS and I have an expression that gives me the sum that I'm looking for, but I still get the warning:

    Warning1[rsAggregateOfMixedDataTypes] The Value expression for the textrun ‘Textbox83.Paragraphs[0].TextRuns[0]’ 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.

    This is my current expression:

    =sum(Cdec(iif(Fields!UserField1.Value = 1, (Fields!UserField2.Value), Cdec(0))))

    I've tried various types of conversion as well as code and no matter what I do I get that warning message.

    UserField1.Value will be either a 0 or 1

    UserField2.Value is a Decimal value and can be NULL although looking at the database there are no nulls, but there are Zeros.

    Like I said I'm getting the right totals, but this is a test database and not very large. I'm concerned that this will cause issues down the road. Any ideas?

    Thanks

  • Sometimes the order of operations can have a significant effect on the way SSRS interprets the results of nested functions. It would probably be best to put the CDec function directly on the field2 value rather than wait to put it on the entire IIF() function. Like this:

    = Sum(IIf(Fields!UserField1.Value = 1, CDec(Fields!UserField2.Value), CDec(0)))

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply