简体   繁体   English

具有where子句的SSRS AVG函数

[英]SSRS AVG function with where clause

I have a question about the avg-function in SSRS/Report Builder. 我对SSRS /报表制作工具中的avg功能有疑问。 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") 对于所有正常工作的事件,我已经做了一个简单的表达: =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") 这是我制作的表达式,应该考虑到紧急性(但不起作用): =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! 谢谢!

I fixed it! 我修好了它! Thanks to @xcvd for helping. 感谢@xcvd的帮助。 I just had to replace the 0 with nothing . 我只需要将0替换为nothing That acts as a NULL and doesn't messes up the calculation. 该行为为NULL ,不会使计算混乱。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM