问题
I current have this report layout
ProductNumberDescriptionPackTypeDimensionWeight
PN 1 Desc PN1 InnerPack 1x1x1 1
PN 1 Desc PN1 SinglePack1x1x1.2 1.2
PN 2 Desc PN2 InnerPack 2x2x2 2
PN 2 Desc PN2 SinglePack2x2.2x2.2 2.3
PN 3 Desc PN3 BulkPack 3x3x3 3
Now, my users want to pivot like this
InnerPack SinglePack BulkPack
ProductNumberDescriptionDimensionWeightDimensionWeightDimensionWeight
PN 1 Desc PN1 1x1x1 1 1x1x1.2 1.2
PN 2 Desc PN2 2x2x2 2 2x2.2x2.2 2.3
PN 3 Desc PN3 3x3x3 3
How can this be done? I'm using MS VS2008.
Thanks
TL
P.S. Thanks to ManisHearth to give me an idea how to create a table in post.
回答1:
You can do this with a standard Matrix. Create a Matrix and add a a Row Group based on ProductNumber and a Column Group based on PackType. I also added a couple more rows to the Matrix to allow some more details in header. I had to split the column header cells to add the Dimension and Weight headers.
Add the detail values to the Matrix body - I removed the automatic Sum that was added to the Weight value, but that's not strictly necessary. It should look something like this in the designer:

One more thing to consider; your PackType groups aren't in alphabetical order, so I updated the Column Group sort expression for your required ordering. I used:
=Switch(Fields!PackType.Value = "InnerPack", 1
, Fields!PackType.Value = "SinglePack", 2
, Fields!PackType.Value = "BulkPack", 3)
Final result, matching your requirements:

来源:https://stackoverflow.com/questions/15036335/ssrs-pivoting-a-column