简体   繁体   English

SSRS 报告,汇总行组中包含的表达式列

[英]SSRS Report, Summing an Expression Column Contained in a Row Group

I have a situation that I am struggling to figure out.我有一个我正在努力解决的情况。 I have a report containing a table with 2 row groups.我有一个包含 2 个行组的表格的报告。 The dataset comes from a SQL view.数据集来自 SQL 视图。
Material Type is the first row group and Material Width is the child/second.材料类型是第一行组,材料宽度是子/秒。 Drilling deeper I have some expressions calculating "linear feet in production" and finally "Tons of Material".钻得更深,我有一些表达式计算“生产中的线性英尺”,最后是“材料吨”。 The row group will show linear feet and tons of material for each material width contained within a material type.行组将显示材料类型中包含的每种材料宽度的线性英尺和材料吨数。 I need to get a sum total of the tons of material for each of the each material types (adding up the tonnage per different widths within the material type).我需要获得每种材料类型的总吨数(将材料类型内不同宽度的吨位相加)。 Below is my expression that calculates the tons of material.下面是我计算材料吨数的表达式。 Any help would be greatly appreciated as I am banging my head.任何帮助将不胜感激,因为我正在敲我的头。 Its possible I have not provided enough information so please ask for more clarification if needed.可能我没有提供足够的信息,所以如果需要,请要求更多说明。 Thanks in advance to anyone that may take a look.提前感谢任何可能看一看的人。

=
(
((Fields!MATLDENSITY.Value)/2000)
*
(Sum(CDbl(Fields!USCATVLS_4.Value))*Fields!Quantity.Value)
*
((CDbl(Fields!USCATVLS_5.Value)/12)
*
(Fields!MATLTHICKNESS.Value/12)
)
)

If I understand you correctly, you have a tablix with 2 row groups.如果我理解正确,您有一个包含 2 个行组的 tablix。 You have an expression that works on the inner group, but you need to sum the results of that.您有一个适用于内部组的表达式,但您需要对结果求和。

What you need to do is specify the scope of your expression (the scope will be you inner row group) and then sum the results of this.您需要做的是指定表达式的 scope (scope 将是您的内部行组),然后将结果相加。

Taking a simple generic example...举一个简单的通用示例...

If you have an expression in the inner group ( myInnerGrp ) that looks like this如果您在内部组 ( myInnerGrp ) 中有一个看起来像这样的表达式

=SUM(Fields!qty.Value * Fields!cost.Value)

As the scope is not specified in the expression above the current scope is used, this is the equivalent to specifying the scope as...由于 scope 没有在上面的表达式中指定,当前使用的是 scope,这相当于将 scope 指定为...

=SUM(Fields!qty.Value * Fields!cost.Value, "myInnerGroup")

So, if you want to sum the results of this in out outer group, the expression would be所以,如果你想在外部组中总结这个结果,表达式将是

=SUM(SUM(Fields!qty.Value * Fields!cost.Value, "myInnerGroup"))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM