Wednesday, March 21, 2012

Reports using Dynamic Columns

Hi..
I am facing a problem with the SQL reporting Service and also am pretty much new to the reporting service…

I need to create a yearly report from a table called say tblData. It has rows like
[items] [Amount] [Date].
Item1 100 05/2005
Item1 110 06/2005
Item2 200 05/2005
Item2 230 06/2005

Now I want the report like
[Items] [First month] [Second month] etc...

The data for the first month, second month etc will be the [amount] for that month.
ie the report rows should be like

[item] [05/2005] [06/2005]

item 1 100 110
item 2 200 230

In the report the month columns will be dynamic according to the data in the tblData table...

Now how should I implement this?

First I though of writing up a Stored Procedure so that the sp returns the formatted data (i.e. a returning a table having the having the dynamic columns). But how can I create the report using these dynamic columns in the reporting service?

Thanks in advance for the replies…
ASMSYou can achieve this with a matrix report item and using a column grouping expression of =Year(Fields!Date.Value)*100 + Month(Fields!Date.Value) to achieve the grouping based on Month/Year.

You may also want to take a look at the sample reports that ship with RS 2000 and RS 2005. Specifically, look at the "Company Sales" report sample.

-- Robert

No comments:

Post a Comment