Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSRS Hide Item in Legend based on conditions

I have a problem related to the legend you can make use of in an SSRS report.

I have a stacked bar diagram in my report, let us call the groups series for Category. The bar chart will display as following:

Category A

Category B

Category C

Category D

...

I have different filters in this report which will only display two categories sometimes, e.g. Cat. A and Cat B. The problem is that the legend still will display all categories even if it is not displayed in the bar chart due to certain conditions made by the users.

I have tried a lot now but without any result. How can i display only Categories in the legend that only exists in the bar?

BR,

Nicklas

like image 529
user2064728 Avatar asked Jun 13 '13 13:06

user2064728


People also ask

How do I create a custom legend in SSRS?

Right-click on a series, or right-click on a field in the Values area, and select Series Properties. Click Legend and in the Custom legend text box, type a legend label.

What is Report legend?

Legends or captions explain figures, tables, or images in the manuscript. As you know, using of figures and tables in research papers serves the purpose of providing illustrative description of the subject matter. Similarly, what legends or captions do is provide descriptive information of the figures or tables.


2 Answers

Right-click on a chart bar, select "Series Properties", choose Legend and click "fx" sign next to "Do not show this series in a legend". Make an expression, which hides legend for this chart bar, if the value is NULL or zero. Here you have an example" http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/0e145eb1-924c-488f-95b1-56028c4f03a8

like image 58
Konrad Z. Avatar answered Sep 28 '22 18:09

Konrad Z.


Right-click on a chart bar, select "Series Properties", choose "Visibility", Select "Show or hide based on an expression", Give your condition(by clicking fx sign you will find condition pane). Example : If you want to show only not null values-

=IIf(Fields!Cat_A.Value is nothing,true,false)

like image 45
Mimi Avatar answered Sep 28 '22 19:09

Mimi