如何同时垂直和水平分组报告?

时间:2016-11-25 14:42:53

标签: c# matrix reporting-services rdlc reportviewer

我在Matrix报告中使用RDLC同时垂直和水平分组。但是我得到的结果与我的目标略有不同。

我的报告是这样的:

enter image description here

目前的结果是这样的:

enter image description here

我的目标应该是这样的:

enter image description here

我的查询数据集如下:

Company year  Tot1           tot2
3001    2016  60.7332300    58.093040
3001    2015  66.1421300    64.754000
3002    2016  211.3360000   94.113000
3002    2015  169.8230000   168.082000

根据alejandro zuleta请求:

![enter image description here

如何更改报告以实现目标?

2 个答案:

答案 0 :(得分:1)

如果您无法更改查询并且比较两年,则可以对Total 1Total 2进行硬编码。

enter image description here

我创建了四列并使用了这些表达式:

=MAX(Fields!Year.Value)将返回2016年 =MIN(Fields!Year.Value)将返回2015

要使用值:

2016年总计1:

=SUM(IIF(Fields!Year.Value=MAX(Fields!Year.Value),Cdbl(Fields!Tot1.Value),0))

2015年总计1:

=SUM(IIF(Fields!Year.Value=MIN(Fields!Year.Value),Cdbl(Fields!Tot1.Value),0))

2016年总计2:

=SUM(IIF(Fields!Year.Value=MAX(Fields!Year.Value),Cdbl(Fields!Tot2.Value),0))

2015年总计2:

=SUM(IIF(Fields!Year.Value=MIN(Fields!Year.Value),Cdbl(Fields!Tot2.Value),0))

你会得到:

enter image description here

  

注意没有创建列组。 Category被添加为Row   基。

如果有帮助,请告诉我。

答案 1 :(得分:0)

理想情况下,您的总类型和年份只需要数据集中的两列,然后就可以在矩阵中进行分组。

要实现这一点,您只需按如下方式设置列分组级别:

  

- TotalType
  ----年
  ------详细

相关问题