SSRS Hide Item in Legend based on conditions - reporting-services

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

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

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)

Related

SSRS chart, how to prevent horizontal axis categories displaying when value is 0

I've placed a simple bar chart into an SSRS report which is designed to display a series of Consultant Names (along the x axis), with a corresponding count of patients who are flagged as being in the category ">18 Weeks" (on the y axis), based on the following expression:
=SUM(IIF(Fields!RTTWaitGroup.Value=">18 Weeks",1,0))
The chart renders fine. However, a number of the Consultants listed in the chart have a zero count, and therefore are listed across the x axis but with no vertical bar displayed, as you'd expect.
I'd like to configure the chart so that it only displays those consultants that have a count of 1 or more patients.
I'm not overly familiar with the syntax, but I've tried using the following expression in both the Series Properties and Chart Properties 'Visibility' options, to try and suppress x axis categories that are zero, but it doesn't have any effect on the chart:
=iif(Fields!LastConsultant.Value ="",True,False)
Please can anyone advise on correct syntax and appropriate expression field to enter it?
Presumably your consultant names will be in the category group, if so right mouse click and select category group properties.Select Filters, in the expression enter count(fields!patients.value)... for example. Change type to integer , operator to greater than and the value to 0.

SSRS Report Builder 2012 - How to hide list based on field value?

I'm using Report Builder 2012 to create a report. I have inserted multiple text boxes and other controls inside a list box so that I can hide all the controls at once just by hiding the list box. I'm using a SQL Server stored procedure to fetch rows of data. I'm using below expression to hide/show the list box.
=iif(Fields!certificateType.Value = "CT", False, True)
It works fine but it only checks the first row of data. If certificateType field is "CT" in the first row of data, it shows the list box but it doesn't hide the list box back for the next row of data in which certificateType is not "CT". It seems like list box visibility only checks the first row of data and applies it for all the other rows as well. How can i check the visibility of list for all the data rows?
Okay, based on our chat I have updated this solution.
I mocked up some data that looks like this:
certificateType
---------------
AT
BT
CT
DT
ZT
I created a quick and dirty report with a list. In that, I added a rectangle with a textbox in it. I set the dataset for the list to the main dataset (DataSet1 in my case). I set the expression for the textbox to this:
=Fields!certificateType.Value
Image in design mode:
I clicked on the list, and in the Row Groups pane, I right-clicked the Details rows, and chose Group Properties. On the General section, I clicked Add to add a new group expression. Then I chose certificateType from the dropdown.
I moved to the Page Break section of the Group Properties dialog and ticked the Between each instance of a group check box. Click OK.
Now, the report will break for each instance of a certificate type that comes in the dataset. So, if you have ten different cert types in the data, you will get one page for each.
You can't see it in my image below, but there are 5 pages now.
Hope this helps!!

lightswitch many to many checkbox filter

Hey guys I have a many to many checkbox where a user can select many cities. I have a dropdown list above for selected state. I want to bring back only the regions that belong to that state that is selected.
thanks
Have you considered using a List and Details Screen instead of a dropdown list? You would just need to add both the states and cities tables to the advanced data section.
However, if you really need to use a drop down box, it is very complex but can be done.
You will need to begin a new search screen and lay it out as follows:
Create a group to start. You will need to 'add data item...' and choose Property, StateTable. Name this 'State' and add it to the group.
Create a second group. Again 'add data item...' Choose Query, CitiesTable (All). Name this StateCities. In the side panel, click 'edit query' next to StateCities and set it up as follows:
Return to your design screen by clicking the 'back to -screenname-' just above the filter statement. You should now see three bold items in the sidebar to the left. The first will be your StateTable, the second will be your StateCites query and the third will be your single State query.
Click the dropdown button for the StateCities query and you will see the query parameters at the bottom. You have a parameter called 'id'
Click on the Id parameter from the sidebar and change the parameter binding property (shown on the right hand side bar) to State.Id. If everything has been done correctly, this should hook up to your state query id field.
Once this is hooked up, you should be able to save your screen and run your program with the desired results!

SSRS - Replace the Chart

I have a question, want some assistance.
Q) My question is that i have a chart in which analyst assigned for many incidents and some analyst have 1 or two incident assigned. just because of this the bar chart looks ugly some time. So thats why i used a new chart to represent Min incident count. But i want there some creativeness, for which i want there a radio button or OnClick event ( I do not know how to use both these. When report runs by default it`ll show Max incidents count chart and when we used radio button it will show Min incidents count chart, on the same chart area no need of new area or on new page.
Kindly help me or refer me some links and with ideas. As i have searched many blogs but i didn`t get any big achievement.
Below is my Simplified query;
SELECT
Count(IncidentDimvw.Id)
,UserDimvw.FirstName AS Analyst
FROM
IncidentDimvw
FULL JOIN WorkItemDimvw
ON IncidentDimvw.EntityDimKey = WorkItemDimvw.EntityDimKey
JOIN WorkItemAssignedToUserFactvw
ON WorkItemDimvw.WorkItemDimKey = WorkItemAssignedToUserFactvw.WorkItemDimKey
JOIN UserDimvw
ON WorkItemAssignedToUserFactvw.WorkItemAssignedToUser_UserDimKey = UserDimvw.UserDimKey
WHERE
WorkItemAssignedToUserFactvw.DeletedDate IS NULL
GROUP BY
UserDimvw.FirstName
Having (Count(IncidentDimvw.Id) = (#Count))
Having Clause is right or wrong, i donot know.
I used the following expresion in series as you suggested.
=iif(Parameters!Count.Value, Max(Sum(Fields!ID.Value)), Min(Sum(Fields!ID.Value)))
Sample data is as folows;
Regards
Muhammad Ahsan
I can think of a couple of ways to approach this:
Dynamic expressions based on parameter
Say you have a simple DataSet like:
And also a boolean parameter called showMax.
We can create a simple bar graph based on this:
The most important thing to note is that Series value is expression-based:
In the above example the expression is:
=IIf(Parameters!showMax.Value
, Max(Fields!value.Value)
, Min(Fields!value.Value))
i.e. when showMax is true, report the Max values, otherwise report the min values.
In this case I've also updated the Axis title, Chart title, and Custom legend text to be expression-based:
Axis Title: =IIf(Parameters!showMax.Value, "Max", "Min")
Chart Title: =IIf(Parameters!showMax.Value, "Max per group", "Min per group")
Custom legend text: =IIf(Parameters!showMax.Value, "Max value", "Min value")
The chart behaviour changes based on what parameter is selected as required:
Set Visibility based on parameter
Another option is simply to have to charts and hide one depending on parameter selection.
For example, for the Max chart the Hidden property can be set to:
=Not(Parameters!showMax.Value)
Setting this property correctly for each report will mean only one is ever displayed to the user, i.e. it will look dynamic.
Either of these options should work; the first keeps the layout simple in the designer makes the chart more complex, the second makes the layout more complex but keeps the charts simple.
Hopefully one option will work for you.

Hide Column based up Parameter Selected SSRS

I would like to set the visibility of columns based upon the value selected in a parameter.
The problem is I do not want a specific parameter to do this (i.e Hide column X True/False)
My report has several different "departments" who are only interested in certain columns.
What would be the syntax for example to hide the "Sales" column when the "Customer Care" parameter is set?
you can do these works step by step:
1- press right click of your mouse in your favorite column
2- select column visibility
3- from opened window select "Show or hide based on an expression" radio button
4- set an expression for hidden state. for example:
=IIF(Parameters!CustomerCare.Value <> "favorite value", true,false)