在矩阵SSRS中填充空日期

时间:2016-02-17 21:54:09

标签: sql reporting-services ssrs-2008-r2

我正在尝试找到一种方法来填充矩阵中没有数据的日期。 我现在所拥有的是

enter image description here

但我想展示其间的所有日期。 我尝试了几种不同的iif语句,但我得到错误或没有改变。

SELECT ee.No, TTMain.CustFn, me.Date_Opened AS [I Open], me.Date_Closed AS [I Sch Close], TTMain.ttfn00, 
   ee.Cls_Date AS [Actual Close Date], ee.Open_Date, TTMain.Project
FROM   GreatAmerican_Data.dbo.Marketing_Escrow AS me INNER JOIN
   GreatAmerican_Data.dbo.Escmst_Escrow AS ee ON me.File_Number = ee.No     INNER JOIN
   ttMain AS TTMain ON ee.No = TTMain.ZeroZerottfn
WHERE  (ee.Branch = '018') AND (me.Date_Opened Between '2/1/16' AND GETDATE()) AND (ee.Status_Date IS NULL)
ORDER BY [I Sch Close]

Data returned with vendor names and account number blacked out

1 个答案:

答案 0 :(得分:0)

  1. 使用月份的完整日期声明月份表
  2. 示例:

    declare @tbMonth as Table (DayOfMonth nvarchar (10))
    insert into @tbMonth ('01 Feb')
    insert into @tbMonth ('02 Feb')
    insert into @tbMonth ('03 Feb')
    insert into @tbMonth ('04 Feb')
    

    ......等等

    1. union @tbMonth与您的输出表,并按[DayOfMonth]分组, 总和([您需要的列])
    2. 完成。