SSRS Tablix 报告,处理列期间总计和子报告比较

发布于 2024-11-04 02:25:18 字数 1107 浏览 1 评论 0原文

我是 SSRS (2008) 的新手,正在尝试复制现有的 Access 报告。该报告按月列出了销售总额,并且我在将基础知识解析为 Tablix 时没有遇到任何问题。然而,原始的 Access 报告随后按季度、6 个月和年度值对列进行总计,此外还应用了子报告来将这些值与上一年的总计和目标进行比较。示意性地

 Sale           Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Total
 Customer 1       1  11  10   8   1   2   0   0   0   1   3   4    40
 Customer 2       0   1   3   1   0   0   0   1   1   0   2   1    10
 MonthlyTotals    1  12  13   9   1   2   0   1   1   1   5   5    50
 Quarterly               26          12           2          11
 6 Monthly                           38                      13
 Yearly                                                      51

 Prev Yr Totals   2  10  10   5   5   0   0   0   0   0   0  10
 Monthly Diff    -1   2   3   4  -4   2   0   1   1   1   5  -5
 Quarterly Diff           4           2           0          10 

如此等等。请注意,设置参数以便报告可以在任何月份开始列出列(针对不同的财政年度)

我在上面的前 4 行(销售、客户 1、客户 2 和每月总计)中一切正常 的最佳方式

  1. ,但无法看到显示季度等总计
  2. 显示子报告以显示前几年和目标值以及它们与当前值之间的差异

。我可以完全访问 SQL Server,并且熟悉复杂的查询和存储过程,因此倾向于在​​表中生成值并显示出来,但是有更好的方法吗?特别是在 SSRS 中处理季度等总计将是有利的。

I'm new to SSRS (2008) and am trying to replicate an existing Access report. The report lists sales totals by month, and I've not had any issue resolving the basics into a tablix. However the original Access report then totals columns by quarter, 6 month and yearly values, and moreover applies incorporates subreports to compare these with previous year totals and targets. Schematically thus

 Sale           Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Total
 Customer 1       1  11  10   8   1   2   0   0   0   1   3   4    40
 Customer 2       0   1   3   1   0   0   0   1   1   0   2   1    10
 MonthlyTotals    1  12  13   9   1   2   0   1   1   1   5   5    50
 Quarterly               26          12           2          11
 6 Monthly                           38                      13
 Yearly                                                      51

 Prev Yr Totals   2  10  10   5   5   0   0   0   0   0   0  10
 Monthly Diff    -1   2   3   4  -4   2   0   1   1   1   5  -5
 Quarterly Diff           4           2           0          10 

And so forth. Note that the parameters are set so that the report can start at any month to lists the columns (for different financial years)

I have everything working fine for the first 4 lines (sale, customer 1, customer 2 and monthly totals) in the above, but cannot see the best way of

  1. Displaying the quarterly etc totals
  2. Displaying the subreports to show the previous years and target values with the differences between them and the current values.

I have full access to the SQL Server and am comfortable with complex queries and stored procedures, so was inclined to generate the values in a table and display out that, but is there a better way? In particular handling the quarterly etc totals in SSRS would be advantageous.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

故事与诗 2024-11-11 02:25:18

我认为单独使用 Tablix 来计算季度总计是不可能的,除非您的SQL 表有一个名为“Quarter”的单独列。

因此,为了实现您的要求,您必须编写简单的存储过程,它返回结果表以及一个名为“Quarter”的附加列,其中包含计算得出的“Q1..Q4”中的值基于销售月份字段。

然后,您可以将此新列(季度)作为 ColumnGroup 添加到 Tablix 中现有组的顶部。

因此,整个想法是创建包含您想要分组的所有可能列的结果集。

I think it is not possible to caclulate the quarterly totals with the help of Tablix alone, unless your SQL Table has a separate column named "Quarter".

So to achieve your requirement, you have to write simple stored-procedure which returns the resultant table along with one more additional column named "Quarter" which contains the values from "Q1..Q4" which is calculated based on the sales month field.

Then you can add this new column (Quarter) as ColumnGroup on top of your existing group in the tablix.

Hence the whole idea is to create the result set with all possible columns for which you want to group.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文