Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
480 views
in Technique[技术] by (71.8m points)

reporting services - SSRS percentage of a total

I would like to be able to get the percentage of each row with relation of the whole total. Here is my formula:

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

The percentage it comes out is the percentage between row total and total of each group:

Group       Qty     %
---------------------
Group 1
MemberA       3   40%
MemberB       4   60%

Total         7

Group 2 
MemberC       2   50%
MemberD       2   50%

Total         4

Grand Total  11

I need to know the percentage with relation of the total for all groupings, like so:

Group       Qty     %
---------------------
Group 1
MemberA       3   30%
MemberB       4   40%

Total         7

Group 2 
MemberC       2   15%
MemberD       2   15%

Total         4

Grand Total  11  100%
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It sounds like what you want to do is calculate based on the dataset, not the table grouping:

=CountDistinct(Fields!ID.Value)/CountDistinct(Fields!ID.Value, "MyDatasetName")

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...