How do I specify specific number of columns in a report

Posted on 2012-10-29
Last Modified: 2013-08-16
Hi All,

I've got a report that I'm building that seems straight forward but teh solution seems to be eluding me.

The report groups on 2 fields
Foreman and Job number.
I want the employees to show up underneath the two groupings in a 4 column horizontal list.

So I would have

Job No1
Emp1 Emp2 Emp3 Emp4
Emp5 Emp6

Job No2
Emp1 Emp2 Emp3 Emp4

Job No1
Emp1 Emp2 Emp3 Emp4
Emp5 Emp6


I've tried lists, tables, Matrix (This is being done in SSRS 2005 after all). All to no avail.

The best I've gotten is by using the
=Ceiling(RowNumber(Nothing)/4) grouping in a list, but then I get the Foreman and Job No. repeated for each of those.

Help Please.
Question by:Craigbob
  • 2
LVL 37

Expert Comment

ID: 38548354
Have a look at the attached example.  It uses the AdventureWorksDW sample database available through Codeplex.
(I hope you can open it, it was created in SSRS2008R2.  If not, try installing Report Builder 3.0, downloadable for free.)

The sample displays product numbers in four columns, grouped by color.

Basically, this is what I've done.  First, the query contains an additional column to indicate the column in which the record should get displayed, DisplayColumn:

select *
		ORDER BY dp.ProductAlternateKey)+3) %4+1 
	as DisplayColumn
from dbo.DimProduct dp

Open in new window

In your case you'd need to PARTITION BY Foreman and Job, and ORDER BY Employee.

The next step is the report.  I'm using nested tables.  The main table has got a group on Color.  The Details level of the table also needs to group on color.

Then, each of the four "detail" textboxes contains another table.  This table is just one detail-level textbox (remove the header row and the two unused columns that get generated automatically when you drag a table into the cell).

Each of these inner tables has got a Filter set.  In column one, the filter is "DisplayColumn = 1".  For the other three columns, change the number to its respective column.

That's it!  Let me know if something here is unclear.

Author Comment

ID: 38551460
Thanks I'll take a look at that. I was already doing something like that in my SQL for the report. My only difference is I was partitioning by Employee Number.

However I don't have adventureworks db on my PC. I did look at the report in report builder and tried to make the modifications to get it to work in 2005 but had no luck.

I was getting multiple rows of the header (foreman) and only one employee per header.
LVL 37

Accepted Solution

ValentinoV earned 500 total points
ID: 38556327
I wrote an article based on your question.  Have a look at it for more detailed step-by-step instructions on getting a multi-column report implemented: Creating Multiple-Column Reports (SSRS)

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Written by Valentino Vranken. Introduction: The first step of creating a SQL Server Reporting Services (SSRS) report involves setting up a connection to the data source and programming a dataset to retrieve data from that data source.  The data…
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question