SSRS percentage rounding problem in an expression

Hello All,

I am using the following expression to calculate percentage in SSRS,
=Format(Fields!PCTanswers.Value/100,"0%")
however, sometime the calculated values aren't equal to 100%  they are 99, so the rounding is not working correctly.
Can someone please help?  Thanks.
Abdul KhanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David Johnson, CD, MVPRetiredCommented:
use =ROUND rather than format
=ROUND(Fields!PCTanswers.Value/100,0)

Format only truncates

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Göran AnderssonCommented:
Using rounding is correct, as David suggested.

However, if you have several values that should add up to 100%, and each value is rounded, you may still end up with a sum that is different from 100%.  That is unavoidable when you are rounding values.

Say for example that you have three values that each represent a third of the total, or 33.333333333333%. When you round them, each will be rounded down to 33%, and the total is 99%.

If you want the values to add up to 100%, you can use the largest reminder method:

1. Round all the values down (but keep the original values also, for now).
2. Calculate how much you have from the sum of the rounded values up to 100%.
3. Distribute that difference by adding one to values, in descending order of the decimal part.

Ref: Wikipedia: Largest remainder method
Abdul KhanAuthor Commented:
Thanks so much for your assistance!!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
SSRS

From novice to tech pro — start learning today.