从单个存储过程返回更多KPI的不同状态

时间:2017-08-02 14:00:46

标签: sql sql-server sql-server-2016

我想创建一个KPI数据集,该数据集将在SQL Report Server 2016中提供更多KPI。

我的存储过程的最后一部分是:

    ---------------------------------------------------------------------------------
-- KPI Result
---------------------------------------------------------------------------------
SELECT
     CONVERT(varchar(4), @YearId) + '-0' + CONVERT(varchar(2), @MonthId)    AS DateId
    ,@ProductType           AS ProductType  
    ,@ePJs                  AS KPI_CZ_Count_ePJ
    ,@PJs                   AS KPI_CZ_Count_PJ
    ,@Plan_CA_PJ_count      AS KPI_CZ_PLAN_Count_PJ
    ,@PJ_NV                 AS KPI_CZ_NV_PJ
    ,@Plan_NV_Prod_PJ       AS KPI_CZ_NV_Prod_PJ
    ,@PJ_NV / @ePJs         AS KPI_CZ_Avg_NV_PJ
    ,@Plan_Avg_NV_per_PJ    AS KPI_CZ_PLAN_Avg_NV_PJ
    ,i.[Status]             AS KPI_CZ_Performance_Status
FROM
    kpi.Indicator i
WHERE 
    (100.0 * @PJs / @Plan_CA_PJ_count) BETWEEN i.RangeMin AND i.RangeMax
    AND NameID = 10 -- Indicator type

表kpi.Indicator中的列状态是针对KPI的背景颜色,如下所示: enter image description here 我希望拥有所有KPI对的状态,例如。 @PJs / @Plan_CA_PJ_count,@ PJ_NV / @Plan_NV_Prod_PJ。

如何实现这一目标? 提前谢谢。

0 个答案:

没有答案