calculated field based on values

  • Bhagat

    Old Hand

    Points: 344

    My report is based on a stored procedure and the columns are outputted to a table in the report.

    I would like to create a expression as a percentage which I require help with?

    At the moment, I have a shared dataset pointing to the SP, so if possible, can this expression be created in the existing shared dataset as a new calculated field?

    The calculation needs to use one of the fields called "Output" and do a count of how many 'Y' are in that field and then divide by the total number of rows in the dataset.

    So, 17000 (Y's) / 20000 (Total number of rows)

    The answer will be just an expression displayed in the title and not required in the table?

     

    Thank you.

  • Sue_H

    SSC Guru

    Points: 90555

    You can't use an aggregate in a calculated field but you could do something like this with an expression in a text box. It doesn't have to be in the table.

    CountRows("YourDatasetName") would give you the number of rows in the dataset.

    SUM(IIF(Fields!Output.Value = "Y",1,0)) would give you the number of Y values for the dataset.

    Sue

  • Bhagat

    Old Hand

    Points: 344

    Thanks Sue,

    Works perfectly!

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

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