formatting percent in SQL Reporting services 2005

Posted on 2007-10-02
Medium Priority
Last Modified: 2010-07-05
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!
Question by:shogun5
LVL 18

Expert Comment

ID: 20007594
Use "P0" as the format string

Author Comment

ID: 20010549
I used:
=Fields!School.Value & " (" & Format((Count(Fields!S_SSN.Value) / Max(Fields!studentpop.Value)*100),"00.") & "%"  & ") of student population"
and it works fine now. Can you explain "P0" to me. I do not understand your comment.
Thanks and advance!
LVL 18

Accepted Solution

PFrog earned 500 total points
ID: 20012499
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"

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 20013006
Thank you for the clarification and advice about CInt.

Expert Comment

ID: 23310832
I can't seem to get this to work with the Percent Stacked Chart.  P0 gives me 4,000 % for 40 on the axis.

Expert Comment

ID: 33140675
it should be

=IIF(Max(Fields!studentpop.Value)=0,100&"%", round(Count(Fields!S_SSN.Value) / Max(Fields!studentpop.Value)*100,2) & "%"

Open in new window


Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Statement In an SAP BI BO Integration project when a BO universe is built on a BEx query, there can be an issue of unit & formatted value objects not getting generated in a BO universe for some key figures. This results in an issue whereb…
Hello, In my precious Article  (http://www.experts-exchange.com/Database/Reporting/A_15280-Create-Project-in-Microstrategy-Part-I.html)we saw the Configuration part for Microstrategy which included Metadata Creation and DataSource Preparation as …
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question