问题
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.
- Add a table to your report and add your 6 detail columns as you have already.
- In the Row Group pane (under the main report design), right-click the
details
group and chooseAdd Group -> Parent Group
. Select WrkCtrId as theGroup By
colum. and Check theAdd Group Header
option too. - You will now have a new column, we can delete this later but keep it for now.
- 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.
- Right-Click on the cell you just set and choose
Insert Row -> Inside Group - Below
. - In the new row, column2 (directly under the cell you set in step 4) select the WrkCtrTableName column.
- 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. - 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!
来源:https://stackoverflow.com/questions/46122555/grouping-in-ssrs