Solved

Formatting numbers contained in SSRS charts

Posted on 2010-09-02
4
372 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to setup a best practice sql maintenance plan Transaction logs full 6 75
when creating a subscription get error 1 44
SQL Upgrade 3 59
Ssrs disable the home lonk 1 77
Hi All, I am here to write a simple article to move SSRS (SQL Server Reporting Services) reports from one server to another. When I have faced the same issue to move reports those were developed by developer on development server and now need to …
Introduction In the following article I’ll be discussing and demonstrating several different ways of how images can be put on a report. I’m using SQL Server Reporting Services 2008 R2 CTP, more precisely version 10.50.1352.12, but the methods ex…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

813 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

10 Experts available now in Live!

Get 1:1 Help Now