开发者

Calculate percentage of total columns based on total column in SSRS Matrix

Looking to add a column in my SSRS Matrix which will give me the percentage from the total column in that row.

I'm using the following expression, but keep getting 100% for my percentages (I'm assuming this is because the total is evaluated last, so it's just doing Total/Total?

=FORMAT((Fields!ID.Value/SUM(Fields!ID.Value)), "P")

The field ID is calcuted within SQL, not SSRS.

For example

Site   |  Value 1  |    %1   |   Value2  |   %2    |   Total
  1    |    20     |   50%   |    20   开发者_运维问答  |   50%   |    40


Probably this is happening because you need define the right scope for the SUM function:

SUM(Fields!ID.Value,"group_name") instead of plain SUM(Fields!ID.Value)

Updated:

I needed some time to make an example since I didn't have reporting services available the first time I answered you.

You can see the result and the field values

Calculate percentage of total columns based on total column in SSRS Matrix

Calculate percentage of total columns based on total column in SSRS Matrix


Hard to provide details without more info on the setup of your groups, but you should look at using the scope option to the aggregate operators like SUM or first:

=SUM(Fields!ID.Value, "NameOfRowGrouping") / SUM(Fields!ID.Value, "TopLevelGroupName")

Also, to keep things clean, you should move your format out of the expression and to either the placeholder properties or textbox properties that contains your value.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜