How do I specify specific number of columns in a report

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.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ValentinoVBI ConsultantCommented:
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.
CraigbobAuthor Commented:
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.
ValentinoVBI ConsultantCommented:
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)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.