formatting percent in SQL Reporting services 2005

Posted on 2007-10-02
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

    Use "P0" as the format string

    Author Comment

    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

    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"


    Author Comment

    Thank you for the clarification and advice about CInt.

    Expert Comment

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

    Expert Comment

    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

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Hi, In my previous Article  ( discussed some basic understanding of Microstrategy that how we can get in Intro of Microstrategy (MSTR). Now it's tim…
    Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    730 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

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now