首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >矩阵控制中嵌套列组头行的倒置

问矩阵控制中嵌套列组头行的倒置
EN

Stack Overflow用户
提问于 2010-10-11 11:47:02
回答 1查看 756关注 0票数 1

在矩阵控件中,我按“大小”对列进行分组,然后按“颜色”对列进行分组。生成的表如下所示:

​

​

我需要反转标题行,因此表如下所示:

​

​

来自子组的值应该在上方显示,这是来自父组的相应值。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-10-11 13:27:34

也许通过使父组成为大小和颜色的组合,但是只显示颜色,然后为子组/子组显示大小组。

更新:

好的,所以我创建了一个小的数据集,我不确定数据集是否像您要返回的数据集,但是它可能会激发一些关于如何在SQL中操作数据以帮助获取报表中所需内容的其他想法。

首先我创造了一堆选择..。UNION ALL语句,但是经过一些操作之后,我仍然无法获得任何接近所需的可视输出/分组的信息。所以我用的是:

代码语言:javascript
复制
with CTE (Color, Size, CSGroup, Amt) As (
select 'Red' As color, 'Small' as size, 'RedSmall' as CSGroup, 1 as Amt union all
select 'Red' As color, 'Small' as size, 'RedSmall' as CSGroup, 1 as Amt union all
select 'Red' As color, 'Medium' as size,'RedMedium' as CSGroup, 1 as Amt union all
select 'Red' As color, 'Medium' as size, 'RedMedium' as CSGroup, 1 as Amt union all
select 'Red' As color, 'Medium' as size, 'RedMedium' as CSGroup, 1 as Amt union all
select 'Red' As color, 'Small' as size, 'RedSmall' as CSGroup, 1 as Amt union all

select 'Yellow' As color, 'Small' as size, 'YellowSmall' as CSGroup ,1 as Amt union all
select 'Yellow' As color, 'Small' as size, 'YellowSmall' as CSGroup ,1 as Amt union all
select 'Yellow' As color, 'Large' as size, 'YellowLarge' as CSGroup ,1 as Amt union all
select 'Yellow' As color, 'Large' as size, 'YellowLarge' as CSGroup ,1 as Amt union all
select 'Yellow' As color, 'Large' as size, 'YellowLarge' as CSGroup ,1 as Amt union all
select 'Yellow' As color, 'Medium' as size, 'YellowMedium' as CSGroup ,1 as Amt union all
select 'Yellow' As color, 'Medium' as size, 'YellowMedium' as CSGroup ,1 as Amt union all

select 'Blue' As color, 'Medium' as size, 'BlueMedium' as CSGroup, 1 as Amt union all
select 'Blue' As color, 'Medium' as size, 'BlueMedium' as CSGroup, 1 as Amt union all
select 'Blue' As color, 'Medium' as size, 'BlueMedium' as CSGroup, 1 as Amt union all
select 'Blue' As color, 'Small' as size, 'BlueSmall' as CSGroup, 1 as Amt union all
select 'Blue' As color, 'Large' as size, 'BlueLarge' as CSGroup, 1 as Amt union all
select 'Blue' As color, 'Large' as size, 'BlueLarge' as CSGroup, 1 as Amt union all

select 'Green' As color, 'Medium' as size, 'GreenMedium' as CSGroup, 1 as Amt union all
select 'Green' As color, 'Medium' as size, 'GreenMedium' as CSGroup, 1 as Amt union all
select 'Green' As color, 'Large' as size, 'GreenLarge' as CSGroup, 1 as Amt union all
select 'Green' As color, 'Large' as size, 'GreenLarge' as CSGroup, 1 as Amt union all
select 'Green' As color, 'Large' as size, 'GreenLarge' as CSGroup, 1 as Amt union all
select 'Green' As color, 'Small' as size, 'GreenSmall' as CSGroup, 1 as Amt union all
select 'Green' As color, 'Small' as size, 'GreenSmall' as CSGroup, 1 as Amt)
Select Color, Size, SUM(Amt) As Amount From CTE group by Color, Size

CSGroup 您可以忽略--我最终没有使用它.

因此,它给了我你在数据集中所需要的“外观”。

我给出了一个矩阵,并按大小和颜色分组(=Fields!size.Value & Fields!color.Value)

然后我插入了一个组,并按大小分组(=Fields!size.Value)。

在“顶部”列分组中,我有=Fields!color.Value

在第二列分组中,我有=First(Fields!Size.Value)

在数据文本框中,我有=Sum(Fields!Amount.Value)

然后,右击第二列分组,并检查框“隐藏副本”。然后我在下拉列表中选择了Dataset1。

由于无法合并文本框,我唯一不能做的就是以大小为中心。

​

​

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3905871

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档