2016-09-22 98 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))) 

所以基本上这些线路相互抵消掉,并填补了国内空白。

相关问题