我正在使用这些表达式将我的数据分组到
列中=CountDistinct(iif((Fields!I_Sch_Close.Value >= DateSerial(Year(Now()), Month(Now()), "1")
AND Fields!I_Sch_Close.Value <= DateSerial(Year(Now()),
Month(Now()), "1").AddMonths(1).AddDays(-1)), 1,0))
=CountDistinct(iif((Fields!I_Sch_Close.Value >= DateSerial(Year(Now()),
Month(Now()), "1").AddMonths(1) AND Fields!I_Sch_Close.Value <=
DateSerial(Year(Now()), Month(Now()), "1").AddMonths(2).AddDays(-1)), 1,0))
=CountDistinct(iif((Fields!I_Sch_Close.Value >= DateSerial(Year(Now()),
Month(Now()), "1").AddMonths(2) AND Fields!I_Sch_Close.Value <=
DateSerial(Year(Now()), Month(Now()), "1").AddMonths(3).AddDays(-1)), 1,0))
=CountDistinct(iif((Fields!I_Sch_Close.Value >= DateSerial(Year(Now()),
Month(Now()), "1").AddMonths(3) AND Fields!I_Sch_Close.Value <=
DateSerial(Year(Now()), Month(Now()), "1").AddMonths(4).AddDays(-1)), 1,0))
这是结果
以下是查询返回的数据
正如您所看到的那样,4月和5月字段显示返回1个结果,当我认为它应该显示为0. No COE(I_Sch_Close) Column
应该是11但是使用以下表达式读取2:
=CountDistinct(iif(ISNOTHING(Fields!I_Sch_Close.Value),1,0))
我做错了什么?
答案 0 :(得分:0)
No COE的以下表达式中的IIf语句返回1或0
=CountDistinct(iif(ISNOTHING(Fields!I_Sch_Close.Value),1,0))
这些的不同数量不能超过2.相反,您需要计算表达式为True的出现次数。尝试这样的事情:
=Count(IIf(<expression>, 1, Nothing))