# SSRS display percentage

Hi Experts,

I have a column which showing percentage,

If it is 89.42, I want it to show +89%
if it is -5.3, I want it to show -5%

This is the expression I wrote in SSRS

+0%;-0%;0%

But it returned
+8942%
-53%

Can you help me on the expression?  Thanks.
###### Who is Participating?

x
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.

Microsoft SQL Server Data DudeCommented:
Guessing the SSRS expression might be a bear.  Recommend doing this in the Source SQL object or code and passing it as a varchar, then just let the SSRS report display the varchar.

For example, copy-paste this into your SSRS, execute, play with the @num and @denom numbers to make sure it works correctly, then modify to meet your needs
``````Declare @num numeric(3,1) = 4, @denom numeric(3,1) = 8

SELECT @num, @denom,
CASE
WHEN ISNULL(@denom, 0) = 0 THEN CAST('0%' as varchar(10))
WHEN ISNULL(@denom, 0) / ISNULL(@num, 0) > 0  THEN '+' + CAST(CAST(@num / @denom as numeric(3,1)) as varchar(10)) + '%'
ELSE CAST(CAST(@num / @denom as numeric(3,1)) as varchar(10)) + '%' END as pct
``````

Experts Exchange Solution brought to you by

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

Author Commented:
Thanks, Jim
Commented:
If you wish to do it within the ssrs expression, you can create an expression to convert it like below;
Assume your SQL query returns a float value field called perc for the percent value that is either 89.42 or -5.3
(ie SQL;  select 89.42 as perc union select -5.3 as perc)
The expression could be written like so;
=IIF(Fields!perc.Value>=0,"+","")+CStr(ROUND(Fields!perc.Value))+"%"
this breaks down to if the value is positive, show a plus, otherwise do nothing (as - shows anyway), then add the percentage value as a string doing a rounding on the value, then add the percentage sign.

If you want to get a bit more complex, assume you want to round down to the nearest whole.  When talking about negative numbers, you probably want the opposite, to round up so;
89.43 becomes 89.
5.3 becomes -5, not -6
In these cases you need to utilise the floor and ceiling math options;
=iif(Fields!perc.Value>=0,"+"+CStr(floor(fields!perc.Value)),CStr(ceiling(fields!perc.Value)))+"%"
###### 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.