Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

format related problem in SSRS: to show upto # decimal places Expand / Collapse
Author
Message
Posted Wednesday, October 15, 2008 6:29 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, February 04, 2009 6:10 AM
Points: 25, Visits: 131
IN REPORTING SERVICES (SSRS)

The expression in a cell is like
=Sum(Fields!a.Value)/Sum(Fields!b.Value)

in output .. i want to show upto 5 decimal places.

Is this possible with a format string?? or any other solution??
Post #586127
Posted Wednesday, October 15, 2008 6:45 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Wednesday, October 02, 2013 2:46 PM
Points: 392, Visits: 82
If you only want 5 decimal places to show up you can use the following as your format string.

#.#####

The pound sign indicates that only 5 numbers should be shown after the decimal. If you always want 5 decimal places to show even for integers you can use zero's instead of pound signs.

For example if you use #.##### as your format string , and the value is 5 it will display as 5.

If the value is 5 and you use #.00000 as your format string, it will display as 5.00000.

Please let me know if this helps.
Post #586137
Posted Wednesday, October 15, 2008 6:54 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Thursday, January 30, 2014 12:45 PM
Points: 339, Visits: 716
Hello...

Please try this once and let me knw if it helps...

=Format(Sum(Fields!a.Value)/Sum(Fields!b.Value),"#.#####");

Thanks,

Post #586146
Posted Wednesday, October 15, 2008 6:56 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, February 04, 2009 6:10 AM
Points: 25, Visits: 131
this is a partial solution... thanks

But if the value is calulated to "0"... then nothing is displayed in that cell
where as output expected is "0.00000"

similarly ... if the value is calculated to "0.123456789" .... then the output expected is "0.12345" .... and "#.#####" displays it as ".12345"

Post #586148
Posted Wednesday, October 15, 2008 7:18 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Monday, August 05, 2013 12:19 PM
Points: 371, Visits: 797
# - specifies an optional placeholder
0 - specifies required placeholder

Format(Table!Field.Value,"#0.00000")

will always return 5 digits after comma.
Post #586171
Posted Wednesday, October 15, 2008 7:29 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, February 04, 2009 6:10 AM
Points: 25, Visits: 131
thanks Glen Sidelnikov :)

"#0.00000" worked!! :D
Post #586183
Posted Wednesday, October 15, 2008 7:33 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Thursday, January 30, 2014 12:45 PM
Points: 339, Visits: 716
My pleasure....

You can try this...

=IIf((Field!val1.Value/Field!val2.Value)>0,Format((Field!val1.Value/Field!val2.Value)),"#0.00000"),"0.00000")

..Let me knw...if it works..

Thanks...

Post #586190
Posted Wednesday, October 22, 2008 4:20 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Tuesday, February 24, 2009 6:19 AM
Points: 92, Visits: 66
Hello,

You can directly Format the TextBox as "N5", then you can get the 5 decimal places for the Number.

Hope this helps
Post #589689
Posted Monday, June 08, 2009 8:34 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, June 08, 2010 12:09 AM
Points: 1, Visits: 13
Thanks, Shilpa..
thats better option to format the textbox to display result upto 5 decimal places
Post #731079
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse