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.
Transposing data with PIVOT operatorYou can create this visualization in tools like SSRS and dbForge Studio for SQL Server. These solutions also allow you to create various reports.
If you want to change column width dynamically, you could try the workaround in this article: SSRS Column Width Auto Size. But your requirement that make the column width reference to a field value returned in dataset cannot be achieved right now. If you still have any question, please feel free to ask.
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:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With