Is it possible to display this data horizontally in SSRS?

筅森魡賤 提交于 2019-12-25 08:48:10

问题


I have a table that that is being joined by another table that looks like this:

Id    Score    Total
1      10       30
1      7        30
1      13       30
2      14       27
2      10       27
2      3        27

I want to be able to display this data like this in SSRS:

Id    1    2    3    Total
1     10   7    13    30
2     14   10   3     27

Can this be done and how?


回答1:


You can do this by using a matrix.

You can add a row identifier for each id in your dataset (assuming you can modify the dataset, as you joined 2 tables). Below code is for SQL Server (T-SQL).

Select Id, Score, row_number() over (partition by id order by score) ident
from table

Output:

Id    Score    Ident
1      10       1
1      7        2
1      13       3
2      14       1
2      10       2
2      3        3

No need of the Total field, you can add it in matrix (Right Click on ColumnGroup>Add Total>After).

Use the above query in Matrix as shown below.



来源:https://stackoverflow.com/questions/40092362/is-it-possible-to-display-this-data-horizontally-in-ssrs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!