Grouping in SSRS?

2019-08-16 02:43发布

问题:

I am new to the SSRS and Have data like to be present as below. They are all from the same dataset, just like to group 2 columns, that is [WrkCrtId, Name] show on top of them. I've tried some ways to do this but still fail, I was wondering if any one can help?

p.s. the image below shows 2 groups (B3 and B7)

回答1:

This is fairly simple to do. This is a quick summary of the things to do from memory so it may not be 100% correct.

  1. Add a table to your report and add your 6 detail columns as you have already.
  2. In the Row Group pane (under the main report design), right-click the details group and choose Add Group -> Parent Group. Select WrkCtrId as the Group By colum. and Check the Add Group Header option too.
  3. You will now have a new column, we can delete this later but keep it for now.
  4. In column 2 (directly above your 1st detail column) click the cell and choose WrkCtrID. This is repeating what is in the left column but that's OK for now.
  5. Right-Click on the cell you just set and choose Insert Row -> Inside Group - Below.
  6. In the new row, column2 (directly under the cell you set in step 4) select the WrkCtrTableName column.
  7. For both the WrkCtrID and WrkCtrTableName cells. Select the cell and the cell(s) to the right, then right click and choose Merge. You can now centre justify the merged cells.
  8. We can now delete the first column (which was added in step 2). If prompted to delete the group too say no.

Below is the report design. I've just used geographical data as a sample dataset but the theory is the same.

And here is the final output.

Hope this helps and good luck!