[英]SSRS: Expression to filter by datepart
我有一个数据集,其中包含给定时间段的电话数据,我需要根据一天中的小时过滤此数据,以便可以在显示高峰期的图表中使用它。
到目前为止,我有这个表达:
=Count(IIF(DatePart("h", Fields!CallStart.Value = 7), Fields!ID.Value, 0))
因此,我希望该表达式可以执行的操作是复制此SQL查询:
select * from PhoneData
where MONTH(callstart) = 7 and YEAR(callstart) = 2012 and DATEPART(HH, callstart) = 7
and Direction ='i' and Part1Device not like 'v%' and Continuation = '0'
在数据集查询中设置月份和年份。
可以说,这种表达方式行不通,我也不知道为什么。任何帮助将不胜感激。
看来DatePart函数的右括号放在错误的位置。 尝试这个。
=Sum(IIF(DatePart("h", Fields!CallStart.Value) = 7, 1, 0))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.