SSRS Warning - rsAggregateOfInvalidExpressionDataType

  • I am trying to get percentage field with the following code -

    =SWITCH(Parameters!Type.Value = 1, IIF(Sum(Fields!LYTD_TransactionsOnline.Value) <> 0,

    Code.DivXbyY(Sum(Fields!TYTD_TransactionsOnline.Value) - Sum(Fields!LYTD_TransactionsOnline.Value),

    Sum(Fields!LYTD_TransactionsOnline.Value)), 1)

    ,Parameters!Type.Value = 2, IIF(Sum(Fields!LYTD_TransactionsOnSite.Value) <> 0,

    Code.DivXbyY(Sum(Fields!TYTD_TransactionsOnSite.Value) - Sum(Fields!LYTD_TransactionsOnSite.Value),

    Sum(Fields!LYTD_TransactionsOnSite.Value)), 1)

    ,Parameters!Type.Value = 3, IIF(Sum(Fields!LYTD_Transactions.Value) <> 0,

    Code.DivXbyY(Sum(Fields!TYTD_Transactions.Value) - Sum(Fields!LYTD_Transactions.Value), Sum(Fields!LYTD_Transactions.Value)), 1))

    This expresssion is giving a warning when the report is run.

    Warning - [rsAggregateOfInvalidExpressionDataType] The Value expression for the textrun ‘Textbox56.Paragraphs[0].TextRuns[0]’ uses an aggregate function with an expression that returned a data type not valid for the aggregate function.

    I don't know why it is giving a warning like this.

    i am using ssrs 2012. Also i dont get what is Code.DivXbyY . I tried to search online but no luck. This code is written by someone else and i am just making changes here.

    Can someone please help me on this. Thanks .

  • Someone has probably written a little bit of code to do division that handles zeros. To see the code in your SSRS report take a look at this link:

    http://msdn.microsoft.com/en-us/library/ms156028(v=sql.110).aspx

    From the error message, it sounds like you're trying to do a SUM() or AVG() (or some such aggregate) on a string.

    HTH,

    Rob

  • Thanks Rob. The link is really helpful.

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

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