SSRS Tablix 报告,处理列期间总计和子报告比较
我是 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 和每月总计)中一切正常 的最佳方式
- ,但无法看到显示季度等总计
- 显示子报告以显示前几年和目标值以及它们与当前值之间的差异
。我可以完全访问 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
- Displaying the quarterly etc totals
- 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为单独使用 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.