SSRS calculate percentage of column based on row total
Asked Answered
H

1

6

I have a data set which looks like this

+------------+-----------------------------+
| user_name  |             role            |
+------------+-----------------------------+
| User A     |  Admin, System              |
| User B     |  Editor, Power User, System |
+------------+-----------------------------+

I would like to calculate the total of each column (A,B) as a percentage of the Row total to look like

+-------+-----+-----+-------+
| Month |  A  |  B  | TOTAL |
+-------+-----+-----+-------+
| Jan   | 90% | 10% | 100%  |
| Feb   | 90% | 10% | 100%  |
| Mar   | 75% | 25% | 100%  |
+-------+-----+-----+-------+

I have tried a Table and Matrix cant seem to get either to work:

enter image description here

Hop answered 5/3, 2014 at 18:5 Comment(0)
B
14

Your % value expression should be something like:

=Sum(Fields!Income.Value) / Sum(Fields!Income.Value, "RowGroupName")

Where RowGroupName is the name of your defined Month row group, as you may notice with the example given.

This applies the total Income for a particular Fee_To / Month group to all Fee_To total Income values in that Month group.

Brucite answered 5/3, 2014 at 18:44 Comment(4)
Hi @Ian thank you for this. seems to work fine until you try it twice. I have one column for Orders and one for Income. I get an error "The Value expression for the text box ‘Textbox153’ has a scope parameter that is not valid for an aggregate function. The scope parameter must be set to a string constant that is equal to either the name of a containing group, the name of a containing data region, or the name of a dataset."Hop
Made a work around. Duplicated the dataset and set it up again.Hop
Please don't use the word "obviously". I'm actually trying to get that very part to work on my report: putting the correct string value in to get the intended behavior. What is obvious to an expert is not obvious to a new person.Slowpoke
I edited the word "obviously" out and tried to convey a similar meaning. I agree with comment by user38858.Ely

© 2022 - 2024 — McMap. All rights reserved.