eloga
eloga

Reputation: 73

Repeat Row group on top of table as table headers between every groups in SSRS

I have a table showing population, and other details of all cities by all countries in the world.

Population of cities by country

This table I have managed to create in SSRS with 'Country' column as a Row Group. Now instead of having the country name taking up the first column I would like to move this information up as table headers/title, so that there is more space to include more details on the right side of the table(which is not showing in the image).

This would mean separating this big table into several small group tables with the country name as the title to be shown just before the table. An example is shown in image below:

Preferred table structure but no solution right now

I have placed a textbox on top of the table and written an expression to show the first of the country name as its value, but the problem is there is no way to link this text box to the row group in the table therefore this textbox is showing only once on top of the report and not repeating with the group.

Upvotes: 2

Views: 2475

Answers (1)

Alan Schofield
Alan Schofield

Reputation: 21683

This is pretty simple to do, so don't worry about the length of the answer!

Create a tablix with just Cities and Population to start with.

In the row group panel under the main designer, you will have one or more row groups (one may be just details but its still a row group).

On the row group (or top row group if more than one) right-click and do Add Group -> Parent Group.

Set the Group by drop down to Country and check the Add Group Header option.

This will add a new column to the left and row above your original group in the designer. In the new row, directly above where you have the 'Cities' caption, click the drop down and choose country.

You can now delete the additional column that was created earlier as we no longer need that.

That will give you the basics... Run the report now and check it works..

To add the word "country" before the Country field, simply double-click the textbox, this will put the cursor at the start of the text box, so you can just type "Country: " before the [Country] placeholder

Optionally, you can select both the new country text box and the cell to the right (above the population caption), right-click and choose 'merge cells'. This will help if the country name is longer that your city column and it just looks neater.

If you couldn't follow that, let me know and I'll post with some images.

Upvotes: 4

Related Questions