Solved

Formatting numbers contained in SSRS charts

Posted on 2010-09-02
4
370 Views
Last Modified: 2012-05-10
Hi,

I want my SSRS chart object to display the sum of one of my data fields in its title. The chart title text is defined as the following expression:
="Days Spent per Category ("
& CStr(Sum(Fields!days_spent.Value)) & " days total)"

Unfortunately this is displayed as:
"Days Spent per Category (66.500000 days total)"
instead of:
"Days Spent per Category (66.5 days total)"

I am already using the SQL ROUND function in the dataset query to ensure days_spent is always rounded to one decimal place, so this is just a presentation issue. Can someone please advise how this number can always be made to present with just one decimal place in my chart legend?

Many thanks.
0
Comment
Question by:irb56
  • 2
  • 2
4 Comments
 
LVL 27

Accepted Solution

by:
planocz earned 250 total points
ID: 33586369
try this
="Days Spent per Category ("
& Sum(Format(Fields!days_spent.Value, "##.#")) & " days total)"
 
0
 

Author Comment

by:irb56
ID: 33586602
Thanks for such a quick response. This is very helpful. When I copied and pasted your code into my report, the chart title displayed "Error" but I quickly worked out that the Format function needs to wrap the Sum function rather than be nested within it. The following expression works perfectly.

="Days Spent per Category ("
& CStr(Format(Sum(Fields!days_spent.Value),"##.#")) & " days total)"

I wouldn't have got to this anything like as quickly without your solution, so much appreciated.
0
 

Author Closing Comment

by:irb56
ID: 33586642
The solution is to use the Format function within the expression as per the expert solution but see my other comment for correction on structure of expression - Format needs to wrap the Sum function not be nested within it.
0
 
LVL 27

Expert Comment

by:planocz
ID: 33586768
I did not have time to test the exact layout, but I knew you would get the idea :)
0

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

After much searching across the internet I have found that you could not set the name of the file you were attaching to dynamic report subscriptons in Microsoft Reporting Services. I did manage to find one article showing you how your could make a s…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
This video discusses moving either the default database or any database to a new volume.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

708 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

21 Experts available now in Live!

Get 1:1 Help Now