Business Intelligence Blogs

View blogs by industry experts on topics such as SSAS, SSIS, SSRS, Power BI, Performance Tuning, Azure, Big Data and much more! You can also sign up to post your own business intelligence blog.

Format a Number in SSRS with CStr and FormatNumber

  • 7 April 2010
  • Author: TimMurphy
  • Number of views: 82854

To make my client's report easier to understand it needed to display a calculated number followed by some text all within one cell. The CStr function was good enough to convert the number to text but the format of the number was not correct. A comma separator for the 1,000’s was needed. The FormatNumber function took care of this but I also had to include 0 for the NumDigitsAfterDecimal argument since this was a count. Optionally you could specify using parentheses for negative numbers and add leading zeros if needed. In my case the number of claims would always be a whole number so here’s how the expression looked:

=FormatNumber(CStr(Count(Fields!Claim_Number.Value)),0)+" Claims"
Categories: Analysis Services
Rate this article:


Other posts by TimMurphy

Please login or register to post comments.