Reporting Services Matrix中计算字段的小计错误

时间:2022-11-20 19:15:29

I've got a Reporting Services report that has two row groups: Category and SubCategory. For columns it has LastYearDataA, ThisYearDataA, LastYearDataB, ThisYearDataB.

我有一个Reporting Services报告,它有两个行组:Category和SubCategory。对于列,它具有LastYearDataA,ThisYearDataA,LastYearDataB,ThisYearDataB。

I added two columns (one for A and one for B) to handle an expression calculation (to show a percentage different from LastYear to ThisYear for each). That's working. The problem comes in the SubTotal for each category. The raw numbers are totaling correctly. If SubCat1 has 10//5 for LastYear/ThisYear A, and SubCat2 has 5//1, then I get 15/5 for the totals. But I get the percentage reported in the total column as "50%", matching SubCat1. Percentages for each Subcategory are being calculated correctly (according to my backup math, anyway). But the sub total % always matches the first SubCategory in the group. Is this impossible to do in Reporting Services 2005?

我添加了两列(一个用于A,一个用于B)来处理表达式计算(显示每个列的不同于LastYear到ThisYear的百分比)。那很有效。问题出现在每个类别的SubTotal中。原始数字总计正确。如果SubCat1对于LastYear / ThisYear A有10 // 5,而SubCat2有5 // 1,那么我得到15/5的总数。但我将总列中报告的百分比设为“50%”,与SubCat1相匹配。正确计算每个子类别的百分比(根据我的备份数学,无论如何)。但子总数%始终与组中的第一个SubCategory匹配。这在Reporting Services 2005中是不可能的吗?

2 个解决方案

#1


Well, I never got to the bottom of this. I changed my sproc to return category totals and a grand total along with all the data. This is going to come up again, so I'll keep looking and maybe I'll discover why with more searching.

好吧,我从来没有深究这一点。我更改了我的sproc以返回类别总计和总计以及所有数据。这将再次出现,所以我会继续寻找,也许我会发现为什么有更多的搜索。

#2


The solution is change the value of the detail field in the Matrix. So where you have:

解决方案是更改Matrix中详细信息字段的值。所以你在哪里:

=Fields!FieldName.Value

Change it to:

将其更改为:

=Sum(Fields!FieldName.Value)

When it's displaying a value in a normal row or column, I guess it just sums the one value, so it doesn't change it, but when it's in a subtotal column, it sums them like you wanted. Counter-intuitive I know. I had to search to figure it out too.

当它在正常的行或列中显示一个值时,我猜它只是将一个值相加,所以它不会改变它,但是当它在一个小计列中时,它会按照你想要的方式对它们求和。反直觉我知道。我不得不寻找解决方法。

#1


Well, I never got to the bottom of this. I changed my sproc to return category totals and a grand total along with all the data. This is going to come up again, so I'll keep looking and maybe I'll discover why with more searching.

好吧,我从来没有深究这一点。我更改了我的sproc以返回类别总计和总计以及所有数据。这将再次出现,所以我会继续寻找,也许我会发现为什么有更多的搜索。

#2


The solution is change the value of the detail field in the Matrix. So where you have:

解决方案是更改Matrix中详细信息字段的值。所以你在哪里:

=Fields!FieldName.Value

Change it to:

将其更改为:

=Sum(Fields!FieldName.Value)

When it's displaying a value in a normal row or column, I guess it just sums the one value, so it doesn't change it, but when it's in a subtotal column, it sums them like you wanted. Counter-intuitive I know. I had to search to figure it out too.

当它在正常的行或列中显示一个值时,我猜它只是将一个值相加,所以它不会改变它,但是当它在一个小计列中时,它会按照你想要的方式对它们求和。反直觉我知道。我不得不寻找解决方法。