SQL Server Reporting Services 2005 - 如何将条件总计放入标题行
假设我有一个像这样的表:
Customer,Invoice Type,Balance
A,Good,50
A,Good,10
A,Bad,20
B,Good,20
我想制作这样的报告:
Customer,Invoice Type,Balance,Total Adjusted Balance
A 40
Good
50
10
Bad
20
B 20
Good
20
其中调整后余额总额是良好发票余额的总和减去客户不良发票余额的总和。
调整后的平衡是我在布局编辑器中使用表达式来计算的吗?或者有更好的方法吗?
(如果我需要在布局编辑器中使用表达式,我该怎么做?)
Let's say I have a table like this:
Customer,Invoice Type,Balance
A,Good,50
A,Good,10
A,Bad,20
B,Good,20
And I want to make a report like this:
Customer,Invoice Type,Balance,Total Adjusted Balance
A 40
Good
50
10
Bad
20
B 20
Good
20
Where total adjusted balance is the sum of the good invoice balances minus the sum of the bad for a customer.
Is adjusted balance something I use an expression in the layout editor to calculate? Or is there a better way?
(If I need to use an expression in the layout editor, how do I do it?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您只需要对标题中的字段进行求和即可。
Reporting Services 非常了解上下文或“范围界定”。
因此,如果您有不同的分组,即国家、州、城镇,
通过引用您希望对每个分组求和的值(例如 SalesAmt),它只会对该特定组内的那些值求和。
http://msdn.microsoft.com/en-us/library/bb630415。 ASPX
You just need to SUM up the fields in the header.
Reporting Services is very aware of context or "Scoping".
So if you have different groupings i.e. Country, State, Town
By refering to the value you wish to sum for each of these (e.g. SalesAmt), it will only sum for those values within that particular group.
http://msdn.microsoft.com/en-us/library/bb630415.aspx
我从来没有使用过SSRS,所以我不知道是否有任何预定义的方法来计算它。您可以使用以下 SQL 来完成此操作:
I've never used SSRS so I don't know if there's any predefined way to calculate it. You can do it using the following SQL: