iif Statement Help

  • I'm attempting to add field DrAmt based on field TranType. So when TranType = "INT" then add the value in DrAmt. Here is my statement:

    =iif(Fields!TrantypeID.Value = "INT",SUM(Fields!DrAmt),0)

    When I run the report I receive this error:

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

    Any help would be appreciated.

    Thanks.

  • I think there's an error in your expression. Are you missing the .Value? (Bolded below)

    =iif(Fields!TrantypeID.Value = "INT",SUM(Fields!DrAmt.Value),0)

  • Oh yeah that would help. Thanks, but the expression does not return the correct value just zero. I know there there data it should be calculating. Any ideas??

  • Looking at your dataset, what values are in the tranTypeID?

    Is there actually a value called 'INT'?

  • Yes the vaules are INT, DEP, WHT

  • I think this will help.

    Try wrapping the sum outside the iif

    =SUM(iif(Fields!TrantypeID.Value = "INT",Fields!DrAmt,0))

  • Still zero amount.

  • Weird, its gotta be something silly.

    Can you post a small sample of your dataset.

    It seems fishy that the field your looking is named TranTypeID.Value, but your comparing it to Text value of 'INT'

  • Here is an example of the data:

    TranTypeID DrAmt CrAmt

    CHK 0.00 13.37

    CHK 0.00 22.50

    ACHO 0.00 10.12

    WD 0.00 35.00

    CHK 0.00 125.00

    CHK 0.00 60.23

    DEP 25.00 0.00

    INT 42.30 0.00

    CHK 0.00 85.30

    CHK 0.00 100.00

    INT 200.00 0.00

  • Are you grouping by Something else? Feels like something is missing.

    Check the attached test Report1, on a row by row basis, the expression is reflecting the amt correctly, so Not sure what the issue is.

  • I did get it to work. I was grouping them like you said. Thanks for your help!!

Viewing 11 posts - 1 through 10 (of 10 total)

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