Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSRS - Vertical merge cells in Details rows

I have stored procudure which returns some data like this:

Trade mode;Area;Production place;Commodity;Reseller;Min_sell_price;Max_buy_price;Trans_count;Volume;avg_price;change_avg_price;last_trade_price;last_trade_volume
"Trade mode1"; "Area name1"; "Place1"; "Commodity1"; "No";  "33601"; "33601"; "1"; "1200"; "33601"; "+28"; "33601"; "1200"
"Trade mode1"; "Area name1"; "Place1"; "Commodity1"; "Yes"; "-";     "33601"; "0"; "0";    "33601"; "+28"; "33601"; "1200"
"Trade mode1"; "Area name1"; "Place2"; "Commodity2"; "No";  "35000"; "35000"; "1"; "180";  "35000"; "0";   "35000"; "180"
"Trade mode1"; "Area name1"; "Place1"; "Commodity2"; "Yes"; "-";     "35000"; "0"; "0";    "35000"; "0";   "35000"; "180"

And I need to create the report is SSRS 2008 R2 which looks like this:

Report example

I have no idea, how to merge cells in columns "Maximum buyer price", "Average price by commodity", "Average price change", "Last deal price", "Last deal volume". I would be grateful for any suggestions.

like image 368
Indian Avatar asked Oct 14 '25 08:10

Indian


2 Answers

There is a way to do this, and it is a bit of a hack. Unfortunately, I don't have enough reputation yet, so Stack Overflow has linked my images rather than embedding them. Just click the links to see the images. Also, I wanted to include 10 images, but I only have enough reputation to embed 8.
Edit (Rafalon): I edited this post so we could see the images without having to follow the links every time.

  1. Insert a table.

  2. Delete the header row by right-clicking it and selecting "Delete Rows".

  3. Right-click a cell in the remaining row, select "Row Group", and click "Delete Group". In the Delete Group dialog box, select the "Delete group only" radio button and click OK.

Delete Group dialog box

  1. The little orange square bracket at the beginning of the row (indicating a group) will disappear.

  2. Right-click a cell in the column where you want to vertically merge cells. In this example, the second column. Select "Add Group", then under "Column Group" select "Parent Group...". The Tablix group dialog box will appear. Enter any value in the "Group by" textbox. It doesn't matter what you enter since you will delete it shortly. In this example, I entered "1". Click OK.

Tablix Group dialog box

Your table will now look like this:

Table with column group

Notice that there is a new square bracket at the head of the column, indicating there is a group there.

  1. Delete the value in the cell (in this example, the "1" I entered).

  2. Right-click the cell again and select "Insert Row". Select "Inside Group - Above". Do that again for as many cells as you want to vertically merge (minus 1 for the original cell). In this example, I want to vertically merge 3 cells, so I clicked "Insert Row" > "Inside Group - Above" twice. There are now three rows in the column group.

Multiple rows in the column group

  1. Select all of the cells in the column that you want to merge. In this case, I am merging all 3. You can do this by clicking the first cell, holding shift and click the last cell, or you can hold down Ctrl and click each cell in turn.

Selected cells in column group

  1. Right-click on your selection and click "Merge Cells".

Merged cells

  1. Now right-click on the merged cells, select "Column Group" and click "Delete Group". Again, in the Delete Group dialog box, select the "Delete group only" radio button and click OK. The orange square bracket at the top of the column will disappear.

Column group deleted

Unfortunately, you will not be able to delete the bottom row that was added when you created the column group.

And there you have it. In the image below, I have a report with 13 subreports. I wanted 2 subreports to show up on the right in the same row as a larger subreport on the left, and it works great.

Example report

This worked for me in Microsoft SQL Server Report Builder 11.0.2100.60 (Report Builder 3.0).

I hope this helps.

like image 116
bryc3monk3y Avatar answered Oct 17 '25 15:10

bryc3monk3y


I don't see why you would need merged columns in your example. You can increase the height of the cells if you need to fit text onto more than one line.

Also if you use borders carefully you can give the appearance of merged cells even though there are not.

I hope this helps

EDIT

I see your example has changed. Insert a table into the cells you want split vertically So price range would be a table inside a table. As would traders.

like image 39
Bobby Avatar answered Oct 17 '25 15:10

Bobby



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!