报告服务 - 矩阵中的百分比

时间:2022-09-23 08:17:43

Reporting Services 2000 SP2

Reporting Services 2000 SP2

I've got a matrix displaying the number of employees

我有一个矩阵显示员工人数

                 Business1      Business2      Business3
StartBefore99    9              14             4
StartAfter99     30             20             34

I'd like to display percentages eg

我想显示百分比,例如

                 Business1      Business2      Business3
StartBefore99    9 (23%)        14 (41%)       4 (10%)
StartAfter99     30 (77%)       20  (59%)      34 (90%)

Any suggestions? I could do it in SQL, but would prefer to do an expression in RS.

有什么建议?我可以在SQL中完成它,但更喜欢在RS中执行表达式。

Cheers

2 个解决方案

#1


0  

What you can do is use an expression so for example

你可以做的是使用一个表达式,例如

= SUM(Fields!StartBefore99.Value) + FORMAT(Sum(Fields!StartBeforeValue99) / Fields!Total.value,2)

= SUM(Fields!StartBefore99.Value)+ FORMAT(Sum(Fields!StartBeforeValue99)/ Fields!Total.value,2)

Total is a field that you calculate in your data set. It's been a while since I touched RS but this is basically the code I wrote before. You need to do a SUM I believe since its a matrix., If this was just a table it'd be a little bit simpler in that you'd not need to do the summing.

总计是您在数据集中计算的字段。我触摸RS已经有一段时间,但这基本上是我之前写过的代码。你需要做一个SUM我相信,因为它是一个矩阵。如果这只是一个表,它会更简单,因为你不需要进行求和。

#2


0  

Many thanks Josh

非常感谢Josh

Here's what I ended up using

这是我最终使用的

=Sum(Fields!StartBefore99.Value) & " (" & Format( ((Sum(Fields!StartBefore99.Value)/Fields!TotalNumberOfPeopleInPlant.value)*100), "0")  & "%)"

I did a TotalNumberOfPeopleInPlant in the SQL and returned the value with each row.. sometime in future I'll look into doing that bit in RS!

我在SQL中做了一个TotalNumberOfPeopleInPlant并且每行都返回了值。将来的某个时候我会考虑在RS中做那个位!

#1


0  

What you can do is use an expression so for example

你可以做的是使用一个表达式,例如

= SUM(Fields!StartBefore99.Value) + FORMAT(Sum(Fields!StartBeforeValue99) / Fields!Total.value,2)

= SUM(Fields!StartBefore99.Value)+ FORMAT(Sum(Fields!StartBeforeValue99)/ Fields!Total.value,2)

Total is a field that you calculate in your data set. It's been a while since I touched RS but this is basically the code I wrote before. You need to do a SUM I believe since its a matrix., If this was just a table it'd be a little bit simpler in that you'd not need to do the summing.

总计是您在数据集中计算的字段。我触摸RS已经有一段时间,但这基本上是我之前写过的代码。你需要做一个SUM我相信,因为它是一个矩阵。如果这只是一个表,它会更简单,因为你不需要进行求和。

#2


0  

Many thanks Josh

非常感谢Josh

Here's what I ended up using

这是我最终使用的

=Sum(Fields!StartBefore99.Value) & " (" & Format( ((Sum(Fields!StartBefore99.Value)/Fields!TotalNumberOfPeopleInPlant.value)*100), "0")  & "%)"

I did a TotalNumberOfPeopleInPlant in the SQL and returned the value with each row.. sometime in future I'll look into doing that bit in RS!

我在SQL中做了一个TotalNumberOfPeopleInPlant并且每行都返回了值。将来的某个时候我会考虑在RS中做那个位!