SSRS旋转列
我目前有此报告布局
产品编号 说明 PackType 尺寸 重量
PN 1 b > Desc PN1 InnerPack 1x1x1 ; 1
PN 1 b > Desc PN1 SinglePack 1x1x1.2 1.2
PN 2 b > Desc PN2 InnerPack 2x2x2 ; 2
PN 2 b > Desc PN2 SinglePack 2x2.2x2.2 2.3
PN 3 b > Desc PN3 BulkPack 3x3x3 nbsp; b ; 3
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
b&b ; nbsp; b b ; b
产品编号 说明 尺寸 重量 尺寸 重量 尺寸 重量
PN 1 b > Desc PN1 1x1x1  > > > ; 1x1x1.2  d b ; d
PN 2 b > Desc PN2 2x2x2  > > ; 2x2.2x2.2 2.3 b ;
PN 3 b > Desc PN3 &nsp kb nbsp; nbsp; nbsp; b ; 3x3x3 nbsp; b kbd> 3
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
这怎么办?我正在使用MS VS2008.
How can this be done? I'm using MS VS2008.
谢谢
TL
P.S.感谢ManisHearth给了我一个如何在帖子中创建表格的想法.
P.S. Thanks to ManisHearth to give me an idea how to create a table in post.
您可以使用标准的矩阵来完成此操作.创建一个矩阵,并根据 ProductNumber 添加一个行组,并根据 PackType .我还向矩阵添加了几行,以允许标题中包含更多详细信息.我必须拆分列标题单元格以添加 Dimension 和 Weight 标题.
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.
将详细信息值添加到矩阵正文中-我删除了添加到 Weight 值的自动 Sum ,但这并不是严格意义上的必要的.在设计器中应该看起来像这样:
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:
还要考虑的另一件事;您的 PackType 组不是按字母顺序排列的,因此我为您所需的顺序更新了列组排序表达式.我用过:
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: