动态更改彩色线图

时间:2014-12-02 08:32:07

标签: sql reporting-services

我有一个ReportingServices报告,它有一个LineChart。 因此,对于图表的一个系列,我已经将这个表达式用于颜色数据集的列。

=iif((Sum(Fields!ProductionActual.Value, "chartDataSet")-Sum(Fields!ProductionPlanned.Value, "chartDataSet"))>0,"LightGreen","Red")

但我只看到一种颜色"红色"。

这是我用来创建图表的查询

DECLARE @TemporaryTable TABLE 
                        (
                        Workcenter NVARCHAR(100),
                        Time Numeric,
                        min datetime,
                        max datetime,
                        StopInMinutes Numeric,
                        WorkingTime NUmeric
                        )

-- Get PO start and end time and the linkupID
DECLARE @DATA_START AS DATETIME
DECLARE @DATA_END AS DATETIME
DECLARE @MACHINE AS NVARCHAR(100)

DECLARE @Date as DATETIME
DECLARE @DateEnd AS DATETIME
SET @Date = '2014-11-24'
SET @DateEnd ='2014-11-26'
DECLARE @ProductionLine AS NVARCHAR(100)
SET @ProductionLine = 'COMBINER001'



SET @DATA_START = @Date
SET @DATA_END =DATEADD(second,86399,@DateEnd) 
SET @MACHINE= @ProductionLine

--SE NELL ELENCO DELLE LINEE Ho inserito la PACKER DEVO 
--AVERE UNA DIVERSA QUERY

 BEGIN
        --QUERY VALIDA PER TUTTE LE MACCHINE - PACKER001
    SELECT 
            mc.equipment as equipment
          , CONVERT (DATE, mc.CreatedOn)  as Data
          ,  sum(mc.quantity) as Production
          , tc.PlannedProduction as ProductionPlanned
          , ABS((sum(mc.quantity) - tc.PlannedProduction)) as ProductionVSPlanned
    FROM 
        [SQLIMELTC\IMELTCPROD].[FlexNet].[dbo].AT_MACHINE_COUNTER mc LEFT JOIN
        iMELReporting.dbo.TC_PlannedProduction tc ON 
            mc.equipment = tc.Workcenter AND
            CONVERT (DATE, mc.CreatedOn) = CONVERT (DATE, TC.PlannedDate) -- don't know if you need the second CONVERT() function
    WHERE 
      mc.CounterType = 1 
      and mc.CreatedOn between @DATA_START and  @DATA_END 
      and tc.PlannedDate between @DATA_START and  @DATA_END 
                  and mc.equipment = @MACHINE 
      and mc.CreatedOn IS NOT NULL
   GROUP BY CONVERT (DATE, mc.CreatedOn), mc.equipment, tc.PlannedProduction
END

这是我的图表的结果。

enter image description here

我预计会有第二列" Red"像那样和第四列" LightGreen"。但是我看到,还有另一个错误,因为灰色列的值有误。他们有" 3310"有价值的,他们应该拥有" 1000"和" 2310"

0 个答案:

没有答案