1

I am trying to create a KPI line chart in SSRS per [Employee] over the time - [Week 25], [Week 24].... [Week 0].

I have a table (dataset) like this (please ignore brackets):

[Employee] [Wk25] [Wk24]...[Wk0]

(John Doe) (0.95)   (0.75) ... (0.80)

(Dow Jones) (1,20)  (0.50) ... (1.10)

(Absalom Absalom) (NULL) (NULL) ... (2.50)

For Excel it is simple, but I gave up building a line chart in SSRS using the dataset as is.

How (if?) should I transform the source table to be able to make a line chart in SSRS? Any ideas will be really appreciated.

4

1 回答 1

0

要在 SSRS 中绘制这些数据,您确实需要取消透视基础数据;它不能很好地处理图表中的表格类型。

在不知道您的基础表的情况下,我无法提供额外的查询,但它会是这样的:

SELECT Employee, Wk, Value
FROM 
   (SELECT Employee, Wk25, Wk24, Wk0
   FROM MyTable) t
UNPIVOT
   (Value FOR Wk IN 
      (Wk25, Wk24, Wk0)
)AS unpvt

SQL Fiddle 与演示

这将给出一个如下所示的数据集:

EMPLOYEE    WK  VALUE
John Doe    Wk25    0.95
John Doe    Wk24    0.75
John Doe    Wk0     0.8

我没有添加所有 26 列,但这应该会给你一个想法。

从这里可以直接在 SSRS 中绘制图表 - 只需添加Value为值数据和WK类别组,您将获得所需的结果。

于 2013-08-29T23:52:11.753 回答