2016-09-22 33 views
0

我需要在我的行組中顯示2015年下的實線。 在屬性中,我輸入了我的表達式=IIF(Fields!YearNum.Value=2015,"Solid",Nothing) 但是由於有些月份沒有值,因此該行被打亂。 enter image description here如何在沒有值的情況下顯示組中的實線?

什麼是解決這個問題的方法?

這裏是T-SQL爲表矩陣

SELECT  CAST(B.YearNum as varchar(10))+ ' Submitted' as Type, 
       1 as OrderNum, 
       ISNULL(COUNT(ControlNo),0) Count, 
       b.YearNum, b.MonthNum, b.MonthName 
    FROM  tblCalendar b 
        LEFT JOIN ClearanceReportMetrics a ON b.MonthNum = MONTH(a.EffectiveDate) AND b.YearNum=YEAR(a.EffectiveDate) 
        AND CompanyLine = 'Argonaut Insurance Company' AND Underwriter <> 'Batcheller, Jerry' 
    WHERE  YEAR(EffectiveDate) IN (2016, 2015) 
    GROUP BY b.YearNum, b.MonthNum,b.MonthName 

UNION ALL 

    SELECT  CAST(b.YearNum as varchar(10)) +' Quoted' as Type, 
       2 as OrderNum, 
       ISNULL(SUM(CASE WHEN QuotedPremium IS NOT NULL THEN 1 ELSE 0 END),0) as Count,   
       b.YearNum, b.MonthNum,b.MonthName 
    FROM  tblCalendar b 
        LEFT JOIN ClearanceReportMetrics a ON b.MonthNum = MONTH(a.EffectiveDate) AND b.YearNum=YEAR(a.EffectiveDate) 
        AND CompanyLine = 'Argonaut Insurance Company' AND Underwriter <> 'Batcheller, Jerry' 
    WHERE   YEAR(EffectiveDate) IN (2016, 2015) --AND CompanyLine = 'Plaza Insurance Company' AND Underwriter <> 'Batcheller, Jerry' 
    GROUP BY b.YearNum, b.MonthNum,b.MonthName 

UNION ALL 

     SELECT CAST(b.YearNum as varchar(10)) +' Bound' as Type, 
       3 as OrderNum, 
       ISNULL(sum(case when TransactionType = 'Policy' then 1 ELSE 0 END),0) as Binds, 
       b.YearNum, 
       b.MonthNum,    
       b.MonthName    
       FROM tblCalendar b 
     LEFT JOIN ProductionReportMetrics a ON b.MonthNum = MONTH(a.EffectiveDate) and b.YearNum = YEAR(a.EffectiveDate) --Coming from Production Report, NOT from Clearance!!!!!!!!!!! 
       AND CompanyLine = 'Argonaut Insurance Company' AND Underwriter <> 'Batcheller, Jerry' 
     WHERE b.YearNum IN (2016, 2015) 
     GROUP BY b.YearNum,b.MonthNum,b.MonthName 

UNION ALL 

    SELECT  CAST(b.YearNum as varchar(10)) +' Declined' as Type, 
       4 as OrderNum, 
       ISNULL(SUM(CASE WHEN Status = 'Declined' THEN 1 ELSE 0 END),0) as Count, 
       b.YearNum, b.MonthNum,b.MonthName 
    FROM  tblCalendar b 
        LEFT JOIN ClearanceReportMetrics a ON b.MonthNum = MONTH(a.EffectiveDate) AND b.YearNum=YEAR(a.EffectiveDate) 
        AND CompanyLine = 'Argonaut Insurance Company' AND Underwriter <> 'Batcheller, Jerry' 
    WHERE  YEAR(EffectiveDate) IN (2016, 2015) 
    GROUP BY b.YearNum, b.MonthNum,b.MonthName 

也試圖改變NULL值0,但仍然給我相同的結果 enter image description here

+0

我從來沒有找到一個簡單的方法來做到這一點,運作良好。您可以使用IIf將0轉換爲空格,將其他任何內容轉換爲數字轉換爲文本,但是當您使用Excel時,您有時會失去添加內容的能力。如果這是一個標準模式,您可以根據它是一個偶數行來做出決定。您還可以在底部添加一個矩形框,底部只有一個實線,當年是2015年時可以看到。 – DaveX

+0

我有任何機會只能做彩色圖案嗎?就像2016年提交的2行和2015年提交的會是一種顏色等等? – Oleg

+0

爲什麼不將這些零值更改爲0? – scsimon

回答

0

您可以處理缺少這樣的價值觀:

=IIF(Fields!YearNum.Value=2015 Or IsNothing(Fields!YearNum.Value) = 1,"Solid",Nothing) 
+0

謝謝,但它給了我一樣的 – Oleg

0

我發現解決方法是: 在屬性,BotderStyle 頂級我寫的表達:

=IIF(Fields!Type.Value="2016 Quoted","Solid", 
IIF(Fields!Type.Value="2016 Bound","Solid", 
IIF(Fields!Type.Value="2016 Declined","Solid", 
Nothing))) 

而對於底部表達:

=IIF(Fields!Type.Value="2015 Submitted","Solid", 
IIF(Fields!Type.Value="2015 Quoted","Solid", 
IIF(Fields!Type.Value="2015 Bound","Solid", 
Nothing))) 

所以基本上這些線路相互抵消掉,並填補了國內空白。

相關問題