Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Reporting Services Development
 SSRS - IIF Expression for Avg Calculation

Author  Topic 

azonicds2
Starting Member

4 Posts

Posted - 2014-02-13 : 10:48:06
Hi

I am working on an SSRS report and would like to create 2 separate average calculations at the bottom.

Basically I have a column that will either have the data "LH" or "FH" for the column "Tenure". I am working out days between an opening date and then completion date and have a column that displays this called "Days_to_Complete. I would like to work out the average amount of days for the "LH" tenure records, "FH" tenure records and then the total for both. I have done the easy one of them both first using:

=Avg(Fields!Days_to_Complete.Value)

But i am stuck on how to do it based on whether the tenure is "LH" or "FH". So far I have the below which I know is not complete:

=IIF((Fields!Tenure = "LH", Avg(Fields!Days_to_Complete.Value))

I get the error:
[rsCompilerErrorInExpression] The Value expression for the textrun ‘Client1.Paragraphs[0].TextRuns[0]’ contains an error: [BC30311] Value of type 'Microsoft.ReportingServices.ReportProcessing.ReportObjectModel.Field' cannot be converted to 'String'.

Can anyone help me or point me in the right direction here?

Thanks
Danny

   

- Advertisement -