Answered by:
Suppress chart line conditionally?

Question
-
I am using SSRS 2005. I have a chart for the financial people that includes an "amount frozen" line. If the amount frozen is 0, I don't want to show the data line at all - not on the chart, nor on the legend. But if it a non-zero value I want it to show up.
(Additionally there is a text box that I want to surpress, but that is easy to do with an if statment in the Visibility/Hidden property.)
Is there a way to do this short of having two separate reports?
Thanks!
BeverleyMonday, July 6, 2009 10:42 PM
Answers
-
Beverly, I can provide a partial solution. In your chart, change the expression for the data value of "amount frozen" to an IIF() evaluation like this:
=iif(Sum(Fields!AMOUNT_FROZEN.Value)=0,nothing,Sum(Fields!AMOUNT_FROZEN.Value))
Based on this approach, the line will not appear on the chart when the value = 0.
It will still appear on the legend, though. I strongly recommend, however, that you avoid using legends if at all possible. If you must have a legend, there are ways to create a custom legend that actually resides/displays in a table. Using this custom approach, I believe you could then suppress, conditionally, the "amount frozen" row.
FYI -- Since you're trying to chart data, please check out Stephen Few's website http://www.perceptualedge.com -- he is a visual analytics expert. Great ideas for graphing data.
Hope that helps,
PeteTuesday, July 7, 2009 7:11 PM
All replies
-
No one? Oh well... two reports it is....
I wouldn't mind an answer to this one even though I'm doing a workaround, if anyone knows! I'm sure it'll come up again in the future, knowing the people I work with! :)Tuesday, July 7, 2009 4:56 PM -
The visibility property only applies to the report item (chart) in SSRS 2005. If you are using SSRS 2008, then the data series themselves have a visibility property that you could take advantage of.
-Sean
Program Manager, SQL Server Reporting Services This posting is provided "AS IS" with no warranties, and confers no rights. http://blogs.msdn.com/seanboon http://www.twitter.com/ssrs- Proposed as answer by Sean Boon Tuesday, July 7, 2009 6:31 PM
Tuesday, July 7, 2009 6:31 PM -
Beverly, I can provide a partial solution. In your chart, change the expression for the data value of "amount frozen" to an IIF() evaluation like this:
=iif(Sum(Fields!AMOUNT_FROZEN.Value)=0,nothing,Sum(Fields!AMOUNT_FROZEN.Value))
Based on this approach, the line will not appear on the chart when the value = 0.
It will still appear on the legend, though. I strongly recommend, however, that you avoid using legends if at all possible. If you must have a legend, there are ways to create a custom legend that actually resides/displays in a table. Using this custom approach, I believe you could then suppress, conditionally, the "amount frozen" row.
FYI -- Since you're trying to chart data, please check out Stephen Few's website http://www.perceptualedge.com -- he is a visual analytics expert. Great ideas for graphing data.
Hope that helps,
PeteTuesday, July 7, 2009 7:11 PM -
Thanks Pete, that'll fix it!Wednesday, July 8, 2009 5:52 PM