SSRS AVG function with where clause

666 Views Asked by At

I have a question about the avg-function in SSRS/Report Builder. What I want to achieve is a expression which is giving a average of the lead time per incident which is taking the urgency of the incident in account. I already made this simple expression for all the incidents which works fine: =Avg(Fields!Lead_time_call__in_days_.Value, "DataSet1")

This is the expression I made which should take the urgency in account (but which doesn't work): =AVG(IIF(Fields!Urgency.Value = "Low", Fields!Lead_time_call__in_days_.Value, 0), "DataSet1")

This displays this: screenshot But that's not possible, since the individual averages can't be all lower than the total average (which is correct)

Does anybody know what I'm doing wrong? Thanks!

1

There are 1 best solutions below

0
On

I fixed it! Thanks to @xcvd for helping. I just had to replace the 0 with nothing. That acts as a NULL and doesn't messes up the calculation.