如何跨SSRS中的所有列组跨行

时间:2019-06-15 19:46:30

标签: reporting-services

我有一个格式非常特殊的报告,无法在SSRS(2016)中实现。它应该具有跨越所有列组的行。这是我在Word中制作的一个粗略的模型,用于演示所需的布局:

Report Layout

所以基本结构是项目列表,每个项目都有一个或多个交易,并且每个交易都有一组会计年度的资金额。

我遇到麻烦的部分是项目标题可能很长,他们希望它覆盖整个行。

我能够使用如下矩阵获得SSRS中实现的大多数报告结构:

SSRS Report Structure

因此,每个项目都有一个父行组,然后每个交易都有一个子行组。会计年度只有一个列组,明细单元包含金额。

以上报告的输出如下所示:

SSRS Report Output

因此,大多数情况下是正确的,但项目标题并未覆盖整行。我想做的是将加粗的 [ProjectTitle] 单元格与右侧的空单元格合并,但是当我选择两个单元格时,没有选择来合并它们。据我了解,您无法合并跨SSRS列组的单元格?

是否有一种解决方法来实现所需的结构?

以下是我用于上述示例的SQL查询:

SELECT * FROM (VALUES
  (1, 'Project Title which can be really long', 1, 'Transaction 1', 2019, 2.25),
  (1, 'Project Title which can be really long', 1, 'Transaction 1', 2020, 7.25),
  (1, 'Project Title which can be really long', 1, 'Transaction 1', 2021, -2.25),
  (1, 'Project Title which can be really long', 1, 'Transaction 1', 2022, 0.55),
  (1, 'Project Title which can be really long', 1, 'Transaction 1', 2023, 6.25),
  (1, 'Project Title which can be really long', 1, 'Transaction 1', 2024, 4.5),
  (1, 'Project Title which can be really long', 1, 'Transaction 1', 2025, 1.25),
  (1, 'Project Title which can be really long', 1, 'Transaction 1', 2026, 1.5),
  (1, 'Project Title which can be really long', 2, 'Transaction 2', 2019, 1.75),
  (1, 'Project Title which can be really long', 2, 'Transaction 2', 2022, 2.25),
  (1, 'Project Title which can be really long', 2, 'Transaction 2', 2024, 0.75),
  (1, 'Project Title which can be really long', 2, 'Transaction 2', 2025, 2.55),
  (1, 'Project Title which can be really long', 2, 'Transaction 2', 2026, 1.5),
  (1, 'Project Title which can be really long', 3, 'Transaction 3', 2020, 2.35),
  (1, 'Project Title which can be really long', 3, 'Transaction 3', 2021, 11.5),
  (1, 'Project Title which can be really long', 3, 'Transaction 3', 2022, -0.55),
  (1, 'Project Title which can be really long', 3, 'Transaction 3', 2023, -0.75),
  (1, 'Project Title which can be really long', 3, 'Transaction 3', 2024, 1.05),
  (2, 'Another Project', 1, 'Transaction 1', 2019, 2.86),
  (2, 'Another Project', 1, 'Transaction 1', 2020, 1.25),
  (2, 'Another Project', 1, 'Transaction 1', 2021, 0.75),
  (2, 'Another Project', 1, 'Transaction 1', 2022, -0.55),
  (2, 'Another Project', 1, 'Transaction 1', 2023, 2.05),
  (2, 'Another Project', 1, 'Transaction 1', 2024, -3.28),
  (2, 'Another Project', 1, 'Transaction 1', 2025, 0.75),
  (2, 'Another Project', 1, 'Transaction 1', 2026, -0.5),
  (2, 'Another Project', 2, 'Transaction 2', 2019, 0.25),
  (2, 'Another Project', 2, 'Transaction 2', 2022, 1.25),
  (2, 'Another Project', 2, 'Transaction 2', 2024, 2.25),
  (2, 'Another Project', 2, 'Transaction 2', 2025, -1.55),
  (2, 'Another Project', 2, 'Transaction 2', 2026, 2.5)
) AS Funding(ProjectId, ProjectTitle, TransactionId, TransactionTitle, FiscalYear, Amount);

1 个答案:

答案 0 :(得分:2)

我不确定是否有办法解决这个问题。如前所述,您不能合并这些单元格,因为它们不在同一范围内。

我将要解决的方法(并不能完全给您想要的结果,而是关闭)是创建一个将ProjectID作为单个值参数的子报告。

数据集查询与此类似。

SELECT * FROM myTable WHERE ProjectId = @ProjectID

我创建的子报表刚刚将标题移到矩阵上方的文本框中。设计看起来像这样...

enter image description here

主报告仅包含一个具有不同ProjectID列表的数据集(在此示例中,数据集仅包含两个值1和2)。

我添加了一个列表控件,将数据集设置为指向唯一的数据集。

在唯一的“单元格”中,我插入了一个子报表,将其指向之前创建的子报表,然后将参数设置为数据集中的ProjectID。

主报告设计如下所示...

enter image description here

最终渲染的输出看起来像这样...

enter image description here