SSRS Tip – Formatting data as a percent

Formatting data within SSRS is fairly easy, for each field there is a format property. By referencing and applying the standard format strings (link below), converting data to something like a percent is simple. The percent is symbolized by a “P” . This reporting case was a little different, as the data was provided as numeric and provided as a percentage. If I used the percentage symbol, the data would have been converted to something much larger; 2700.00 %, instead of the more realistic 27.00 % (example below).

Additionally, there was a need to format the numeric data to a Fixed decimal, with 2 decimal places (hint: format code = “F2”)

clip_image001

To solve this issue, in design mode, right click the field, select Expression… use the expression builder property sheet, we first format the numeric field to fixed decimal, 2 decimal places, then append the percent sign.

In somewhat symbolic language, it looks like this:

= FORMAT ( <field>, “FormatCode”) & “ %”

Applied to the actual field:

clip_image002

Results:

clip_image003

Reference

Standard Numeric Format Strings

http://msdn.microsoft.com/en-us/library/dwhawy9k

Advertisements
This entry was posted in SQL Server, SSRS. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s