Pivoting in SSRS 2005 Reports
Now i am getting results from sql server like this Date_range Week Total 06/01/2011-06/04/2011 1 18 06/05/2011-06/11/2011 2 28 06/12/2011-06/18/2011 3 38 06/19/2011-06/25/2011 4 58 but i want to display this data in the below format in SSRS 2005 (06/01/2011-06/04/2011) (06/05/2011-06/11/2011) (06/12/2011-06/18/2011) (06/19/2011-06/25/2011) 1 2 3 4 18 28 38 58 Is it possible to achive this in SSRS 2005?
June 15th, 2011 7:03am

I am afraid this is not possible in SSRS 2005 to have 2 Rows for same Column Grouping.Rakesh M J Dont forget to mark it as Answered if found useful MCTS,MCITP,MCSS http://mycubeandreports.blogspot.com/
Free Windows Admin Tool Kit Click here and download it now
June 15th, 2011 7:16am

T-SQL solution create table #t (Date_range varchar(50), w int,total int) insert into #t values ('06/01/2011-06/04/2011',1,18) insert into #t values ('06/05/2011-06/11/2011',2,28) insert into #t values ('06/12/2011-06/18/2011',3,38) insert into #t values ('06/19/2011-06/25/2011',4,58) select MAX([06/01/2011-06/04/2011])[06/01/2011-06/04/2011], MAX([06/05/2011-06/11/2011])[06/05/2011-06/11/2011], MAX([06/12/2011-06/18/2011])[06/12/2011-06/18/2011], MAX([06/19/2011-06/25/2011])[06/19/2011-06/25/2011] from (select Date_range,w ,total from #t) AS d PIVOT ( MAX(w) FOR Date_range IN([06/01/2011-06/04/2011], [06/05/2011-06/11/2011], [06/12/2011-06/18/2011], [06/19/2011-06/25/2011]) ) AS P1 UNION ALL select MAX([06/01/2011-06/04/2011])[06/01/2011-06/04/2011], MAX([06/05/2011-06/11/2011])[06/05/2011-06/11/2011], MAX([06/12/2011-06/18/2011])[06/12/2011-06/18/2011], MAX([06/19/2011-06/25/2011])[06/19/2011-06/25/2011] from (select Date_range,w ,total from #t) AS d PIVOT ( MAX(total) FOR Date_range IN([06/01/2011-06/04/2011], [06/05/2011-06/11/2011], [06/12/2011-06/18/2011], [06/19/2011-06/25/2011]) ) AS P2 Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/
June 15th, 2011 7:34am

I think if data is already in fields using query just dump iut in matrix report as "Range" as column groups and "week n Total" filed in row groups another way is ..just put the field directly in the matrix for which u calculated the total n get the total in matrix. please correct me if i understood ur requirments wrongly. -------------------------------------------------------------------------------- Please mark my post as an answer if I helped you to resolve the issue or vote up if I helped you.Thanks. Regards and good Wishes, Maqbool.
Free Windows Admin Tool Kit Click here and download it now
June 15th, 2011 7:52am

Hi Aravinda, Thanks for other communities' professional solution, here just give another alternative besides the T-SQL, we can still achieve this requirement in reporting services level by creating a horizontal tables, steps are: 1. Add a matrix to your report 2. Right-click in the Data cell and select "Add Row" to add static row to the matrix, repeat for the number of fixed rows you want, here is Three rows for your requirement. 3. Drag fields(Date_range\Week\Total) into the Data cells, you'll notice that the design tool automatically wraps your field reference in the "First" aggregate (e.g. =First(Fields!Date_range.Value)). please do not remove the aggregation function. 4. Right-click on the column header and select "Edit Group". Enter this for the group expression: =RowNumber(Nothing)to add a column group. This will cause the matrix to give you one column per row of data. Since horizontal tables can end up rather wide, you probably want your table wrap around to the next "line" after a specific number of columns. 5. Add a list to your report and drag the table into it 6. Right-click on the list and select Properties. Then click on Edit Details Group. Enter this for the group's expression: =Ceiling(RowNumber(Nothing)/3) This will cause the list to group on every three rows. So you'll get a separate table for every three rows. Note: you can change the number 3 to other number based on your requirement. 7. Adjust the group expression in the matrix Edit the column group expression in your matrix and change the RowNumber argument to be the list group name. For example: =RowNumber("list1_Details_Group") Thanks, Challen FuPlease remember to mark the replies as answers if they help and unmark them if they provide no help.
June 16th, 2011 3:37am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics