none
Round Down (or not at all) and display as percent to 2 Decimal Places

    Question

  • Hello,

    I have a report in SSRS with a number of computations done in the tablix.  I need to format an expression such that the value will be displayed as a percentage with 2 decimal places that is truncated(not rounded).

    For example,

    0.66666 should be displayed as 66.66% (not 66.67%)

    0.5 should be displayed as 50.00%

     I have done much Googling and have tried everything I can think of but no luck.

    I would appreciate any help anyone can provide.

    Thanks!


    Scott Olander

    Tuesday, December 24, 2013 7:32 PM

Answers

  • Hi Scott,

    Please refer to the following expression:

    =CDec(Left(SUM(Fields!CorrectAudits.Value)/SUM(Fields!IncorrectAudits.Value + Fields!CorrectAudits.Value),6))


    Then, configure the text box Number property with Percentage.

    If you have any questions, please feel free to let me know.

    Regards,
    Alisa Tang


    Alisa Tang
    TechNet Community Support

    • Marked as answer by Scott Ola Tuesday, December 31, 2013 2:21 PM
    Monday, December 30, 2013 1:42 AM

All replies

  • Hi Scott,

    In your case, we can use Left () function to work around the issue.

    Suppose we have a field named Amount in the report. Please refer to the expression below:
    =Left((Fields!Amount.Value * 100),5) & "%"
    Please refer to the screenshot below:

    If you have any questions, please feel free to let me know.

    Regards,
    Alisa Tang


    Alisa Tang
    TechNet Community Support

    Wednesday, December 25, 2013 7:40 AM
  • Hi Alisa,

    Thanks for your response; it was very helpful.  Unfortunately I'm still having some difficulty...

    When applied to a hardcoded numeric value, your solution seems to work perfectly:

    =Left(0.66666 *100, 5) &  "%" ---> 66.66%

    I had to modify it slightly when applying it to one of my calculations as whole percentages were not displaying .00 to the right of the decimal point.  This is what I modified it to:

    Left(Format((Fields!CorrectAudits.Value/(Fields!InCorrectAudits.Value + Fields!CorrectAudits.Value) * 100), "N"), 5) & "%")

    This works perfectly when applied to this particular calculation, but for some reason when I apply it to the following calculation I get funky results:

    Original calculation:

    = SUM(Fields!CorrectAudits.Value)/SUM(Fields!IncorrectAudits.Value + Fields!CorrectAudits.Value)

    Modified calculation:

    =Left((SUM(Fields!CorrectAudits.Value)/SUM(Fields!InCorrectAudits.Value+Fields!CorrectAudits.Value)*100), 5) & "%"

    Results:

    0.66666 ----> 66.66 %   (This is as desired)

    0.25      -----> 25%        (Should be 25.00%)

    0.07692      ------> 7.692 %  (This should be 7.69%)

    Adding the Format "N" piece to this calculation fixes the issues with 0.25 and 0.07962 but causes 0.6666 to round to 66.67% (not the desired result).

    Do you have any ideas?  Am I doing something wrong and just not seeing it?

    Thanks again for your help.

    Scott

     

     

     


    Scott Olander

    Thursday, December 26, 2013 5:02 PM
  • Hi Scott,

    Please refer to the following expression:

    =CDec(Left(SUM(Fields!CorrectAudits.Value)/SUM(Fields!IncorrectAudits.Value + Fields!CorrectAudits.Value),6))


    Then, configure the text box Number property with Percentage.

    If you have any questions, please feel free to let me know.

    Regards,
    Alisa Tang


    Alisa Tang
    TechNet Community Support

    • Marked as answer by Scott Ola Tuesday, December 31, 2013 2:21 PM
    Monday, December 30, 2013 1:42 AM
  • Hi Lisa,

    Thanks again for your help.  I also came up with an alternate solution:

    =Floor(SUM(Fields!CorrectAudits.Value)/SUM(Fields!InCorrectAudits.Value+Fields!CorrectAudits.Value)*10000)/10000

    Thanks again and have a wonderful New Year!


    Scott Olander

    Tuesday, December 31, 2013 2:25 PM