我在 SSRS 中有一份报告,其中计算了每个月使用的项目,但由于当月没有使用任何项目,所以缺少一些月份。
=count(Fields!Drug.Value)
ie Jan=2, Mar=1, Apr=3, June=4
如果特定月份没有数据,我希望出现月份分组,并且计数显示为“0”。
ie Jan=2, Feb=0, Mar=1, Apr=3, May=0, June=4
如果尝试了 IsNothing 表达式,但在没有数据的情况下几个月仍不显示“0”。
=IIF(IsNothing(count(Fields!Drug.Value)),0, count(Fields!Drug.Value))
'当月(BagDoseStartDateTime)在 7 和 12 之间时选择不同的情况,然后 cast(right(year(BagDoseStartDateTime),2) as varchar(10)) + '/' + cast(right(year(BagDoseStartDateTime) + 1,2) as varchar(10)) else cast(right(year(BagDoseStartDateTime) - 1,2) as varchar(10)) + '/' + cast(right(year(BagDoseStartDateTime),2) as varchar(10)) end as FinancialYear ,year(BagDoseStartDateTime) as YearAdministered ,month(BagDoseStartDateTime) as MonthAdministered ,D.[Drug] ,D.[BagDoseStartDateTime]
FROM CAB_Reporting.dbo.CAB_V_Doses_Bags D --内部加入 CAB_Reporting.dbo.CAB_V_Dose_Actions DA on DA.PatientID = D.PatientID
其中 ((year(BagDoseStartDateTime) = 2016 and month(bagDoseStartDateTime) >6) 或 (year(BagDoseStartDateTime) = 2017)) 和 ((D.Drug Like 'Red Blood Cells (1 Unit)' And D.Status Like 'Administered ') 或 (D.Drug Like 'Fresh Frozen Plasma (FFP 1 Unit)' And D.Status Like 'Administered') 或 (D.Drug Like'Cryoprecipitate (Multiple Units)' And D.Status Like 'Administered') 或(D.Drug Like 'Platelets (1 Unit)' And D.Status Like 'Administered'))按年排序(BagDoseStartDateTime),月(BagDoseStartDateTime)'