Question : formatting percent in SQL Reporting services 2005

How do I format the following:
=Fields!School.Value & " Percentage (" & (Count(Fields!S_SSN.Value) / Max(Fields!StudentPop.Value))*100  & "% )"
so my percent shows now digits to the right of the decimal?  Right now my output is:

Percentage (25.8205689277899%)

Thanks in advance!

Answer : formatting percent in SQL Reporting services 2005

Hi Mike

Sorry, I should have clarified that. If you look at the properties of a textbox (or a table cell) there is a property called Format. Se this to P0 and it will format the textbox contents to a % with no decimals (P2 would be a % with 2 decimals etc.)

However, as you are building a string containing more than just the % (with the shool name and descriptor) this will not actually work for you unless you seperate them out into seperate textboxes. Your approach is probably the best option. However you can tidy the code slightly by using CInt() to get rid of decimal places

=Fields!School.Value & " (" & CInt(Count(Fields!S_SSN.Value) / Max(Fields!studentpop.Value)*100) & "%) of student population"

Random Solutions  
 
programming4us programming4us