How to correct percentage calculation that always = 100%?
I created a tablix in SSRS 2008 and I added several rows to this. The first 3 rows work correctly and display sums. But now the 4th and 5th rows do not work correctly. Instead, these two rows always display 100%, regardless of values for
the first 3 rows. To simplify, I want the fourth row to display the percentage representing (Sum of "Row 1") / (Sum of "Row 2"). How can I do this?
Here is what I did now. For Row 4, I added the expression:
=Round(Sum(Fields!Num_Closed_in_5.Value) / Sum(Fields!NumClosed.Value), 0)
And for that same row, I grouped it on "[Num_Closed_in_5]"
and in this same group I filtered on "[Num_Closed_in_5]" > 0
and I set the Textbox properties to Percentage with 0 decimal places.
So I should see percentages like: "96", "96", "85", etc.
But instead I am seeing: "100", "100", "100". And I also tried dividing by 100 in the expression, but that gave me: "1", "1", "1", etc.
Ryan D
June 30th, 2011 4:59pm
Hi ironryan77,
From your scenario, I suspect that the issue is caused by Round function, you are using “0” as a parameter in the Round function, that means the expression is useful to round numbers to the nearest integer. Please take the following expression
as an example in your tablix, and then check if it works for you.
=Round(Sum(Fields!Num_Closed_in_5.Value) / Sum(Fields!NumClosed.Value), 2)
Note: parameter “2” means remain 2 decimal points
For more information about it, please refer to the following article,
Round Function:
http://msdn.microsoft.com/en-us/library/se6f2zfx(v=VS.85).aspx
Please let me know if my understanding is worng.
Thanks,
Eileen
Free Windows Admin Tool Kit Click here and download it now
July 1st, 2011 4:31am
ironrayon77,
Its look like something with the group you created for row no 4 "[Num_Closed_in_5]".
I would suggest you to remove the group and leave everything as it is.
What you can do instead is
-> Add a Total field on the tablix that will create a default (Detail) group.
-> Add you expression to it :
=Round(Sum(Fields!Num_Closed_in_5.Value) / Sum(Fields!NumClosed.Value), 0)
Regards
Manoj
July 1st, 2011 4:59am
Thanks, Manoj! That did it!Ryan D
Free Windows Admin Tool Kit Click here and download it now
July 1st, 2011 8:42am