Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How do I specify specific number of columns in a report

Posted on 2012-10-29
5
Medium Priority
?
920 Views
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

Foreman1
Job No1
Emp1 Emp2 Emp3 Emp4
Emp5 Emp6

Foreman1
Job No2
Emp1 Emp2 Emp3 Emp4

Foreman2
Job No1
Emp1 Emp2 Emp3 Emp4
Emp5 Emp6

etc....

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.
0
Comment
Question by:Craigbob
  • 2
3 Comments
 
LVL 37

Expert Comment

by:ValentinoV
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 *
	, (ROW_NUMBER() OVER (
		PARTITION BY dp.Color
		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.
Report6.rdl
0
 

Author Comment

by:Craigbob
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.
0
 
LVL 37

Accepted Solution

by:
ValentinoV earned 2000 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)
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

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

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

824 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