SSRS: Getting a specific value from different rows of a dataset

江枫思渺然 提交于 2019-12-10 20:44:32

问题


I'm sitting here, working with SQL Server Reporting Services and I am stuck with the following problem:

I have written an SQL Statement which returns for a Client for every day of the year if he was absent or not.

So for example the result could look like this:

-------------------
| Date   | Absent |
-------------------
| 01.01. | True   |
| 02.01. | False  |
|    .   |   .    |
|    .   |   .    |
| 31.12. | False  |
-------------------

Now for the Report I want to use a Tablix where I have the days as column headers and the months as row headers and in the right cell a value which marks if the client was on a day absent or not (as an example I use :) as here and :( as absent):

-------------------------------
|    | 01 | 02 | .  | .  | 31 |
|Jan | :( | :) | .  | .  | :) |
|Feb | .  | .  | .  | .  | .  |
| .  | .  | .  | .  | .  | .  |
| .  | .  | .  | .  | .  | .  |
|Dec | .  | .  | .  | .  | :( |
-------------------------------

I just can't come up with any solution for my problem so any help will be appreciated :)


回答1:


Create a Tablix, with the columns grouped on the expression =Day(Fields!Date.Value) and the rows grouped on =Month(Fields!Date.Value)

For the cell value set the source to an expression:

=IIF(SUM(Fields!Absent.Value)>0, ":(" , ":)" )

Of course, you could add an image, and change the image source dynamically with a similar expression.



来源:https://stackoverflow.com/questions/12933562/ssrs-getting-a-specific-value-from-different-rows-of-a-dataset

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