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:
There is no built-in operator that calculates percentages in SQL Server. You have to rely on basic arithmetic operations i.e. (number1/number2 x 100) to find percentages in SQL Server.
After that, you can follow Syed's suggestion to change the “Category:” to “Percent” in the Number tab of the Text Box Properties dialog. If it is a field in the details row of the “CountryTotal” column like “=Fields! SalesAmount”, then you can set the expression in the details row of the third column to “=Fields!
To calculate x percent of y: Divide x by 100. Multiply x by y. The resultant number is x% of y.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With