Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Formatting numbers contained in SSRS charts

Posted on 2010-09-02
4
Medium Priority
?
394 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 27

Accepted Solution

by:
planocz earned 750 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Introduction Earlier I wrote an article about the new lookup functions (http://www.experts-exchange.com/A_3433.html) that ship with SQL Server 2008 R2.  In this article I’m going to show you another new feature of SSRS 2008 R2, this time in the vis…
It is helpful to note: This is a cosmetic update and is not required, but should help your reports look better for your boss.  This issue has manifested itself in SSRS version 3.0 is where I have seen this behavior in.  And this behavior is only see…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Loops Section Overview

610 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