需要在SSRS中显示记录Group By

Need to Display records Group By in SSRS

在 SSRS 2008 中,我正在开发应该根据条件显示记录的报告:它应该根据 gift_type 给我 amt_total(这里,amt_totalgift_type 是 table) 的列。 这是我正在使用的查询。

SELECT   o110113.gift_batch_no, 
     o110113.gift_type, 
     (o110113.gift_date),
     o110113.feed_doc_code, 
SUM (o110113.amt_total)
FROM GIFT_CARD o110113
   WHERE (o110113.gift_type IN
             ('RR', 'RB', 'CR', 'RM', 'RW', 'CW', 'RJ', 'RO', 'RK', 'CI')
     )
GROUP BY o110113.gift_batch_no,
     o110113.gift_type,
     (o110113.gift_date),
     o110113.feed_doc_code
ORDER BY o110113.gift_batch_no ASC, o110113.gift_type ASC

我尝试在 SSRS 2008 中生成的报告应该如下所示。

Clikck this to see the Image of the Report that I am trying to develop

我正在尝试使用 SSRS 表达式

 =Sum(Fields!SUM_O110113_AMT_TOTAL_.Value,"GIFT_TYPE")

它向我抛出错误:

Please click this to see an Error I am getting in SSRS

请提供解决方案

这是我开发的报表设计

[点击查看报道图片]

谢谢 阿伦

该错误与您求和的范围有关。没有看到数据集并假设它不是基于图像的嵌套聚合操作。您正在尝试引用列名 "GIFT_TYPE",而它实际上应该是记录集的名称,或者是适当的范围(数据 region/group)。

下面是 link

范围的工作原理

The value of scope must be a string constant andcannot be an expression. For outer aggregates or aggregates that do not specify other aggregates, scope must refer to the current scope or a containing scope. For aggregates of aggregates, nested aggregates can specify a child scope.

你会想看这个link了解更多信息

在这里您需要对 Tablix 进行分组。 首先,您需要在 gift_batch_no 上添加行组,以便根据礼品批次显示。 您必须在礼品类型上创建另一个行组,在第二个组类型中,您需要设置总金额的总和。

如果您有任何其他疑问,请告诉我