Currently i wanted to search multiple value in one available value which configured in SSRS.
Now user required to click one by one to filter their report as per below.
enter image description here
However they requested to group red highlighted into 'CCB KV' and green highlighted into 'CCB N' therefore instead user click one by one and they can directly click 'CCB KV' to filter those red highlight.
Currently we expect to use the available value option below to create 'CCB KV' and store those red highlighted and not require any script change. However it seems like available option only allow single value to store instead of multiple value and the query is using where clause as 'ce.branch_code in (#branchCode)' to obtain the result.
enter image description here
Seek you advise whether available value able to store multiple value.
The easiest way would be to add a table to your database containing the relationship between the parameter value and the values you actually want to search for.
For example you could create a dataset with the following in your dataset query.
CREATE TABLE myLookupTable(AreaName varchar(50), LocationName varchar(50))
INSERT INTO myLookupTable VALUES
('Area ABC', 'Tower A'),
('Area ABC', 'Tower B'),
('Area XYZ', 'Tower X'),
('Area XYZ', 'Tower Y')
For you parameter list you could then create a dataset in your report something like
SELECT DISTINCT AreaName from myLookupTable ORDER BY AreaName
Set the available values of your parameter to point to this dataset.
Then in you main dataset, just add a join in to this new table
SELECT a.* FROM myMainTable a
JOIN myLookupTable b on a.LocationName = b.LocationName
WHERE b.AreaName IN (#myParameterName)
I have a report that contains 3 parameters. Start Date, End Date and Segment. The Segment parameter is a multi-value and is set-up as a default. When I run the report (after clicking view report) the Segment parameter value goes blank. When I select several values the report runs, but when I select all the parameter removes the default. I tried to troubleshoot the issue in Visual Studio 2013 and it runs fine, the issue is when it runs from the SSRS report server. Please advice. Thanks.
You can resolve the no data issue by doing the following:
assuming that your parameter names are :
#startdate, #enddate,#segment
Get a list of distinct segment values for your segment dataset.
For that you need to do something like the following
Assuming your table name is segmenttable and your column is segmentcolumn and there is a date somewhere that you join to do get all the distinct segment columns between the dates..
set your query for the segment parameter list to the following (something similar of course)
select distinct
segmentcolumn
from segmenttable
where segmenttable.segmentdate between #start_date and #enddate
This will always ensure that the segment parameter only has values between the dates that is selected and never any value that has "no data" associated with the segment..
Now set your available value and default value for your #segment parameter from this dataset. Done!
I need to create a SSRS report to present actual start date vs. planned start dates for milestones of a project (selected as input parameter)
The chart should look like this:
I have created the table in a separate table. However, I don’t know which chart type should I use and how do I have to set up the chart? (Chart Data, Category Groups and Series Groups).
(Data comes from SQL Server, SSRS Version 14.0.1016.285; SSDT 15.6.4)
Many Thanks in advance
This might look a bit long winded but it's fairly simple so stick with it :)
To start with I did not know your data structure so I've just made some assumptions. You may have to rework some of this to get it to fit but I've tried to keep it simple.
The approach will be to use a subreport to plot the dots and a main report to show the overall table. With this in mind, as we will have more than one dataset referencing our data I added some tables to my sample database before I started wit the following.
The first is a simple table containing months and years, you could a use view over a date table if you have one but this will do for now.
CREATE TABLE prjYearMonth (Year int, Month int)
INSERT INTO prjYearMonth VALUES
(2018, 8),
(2018, 9),
(2018, 10),
(2018, 11),
(2018, 12),
(2019, 1),
(2019, 2)
Next is the project milestone table
CREATE TABLE prjMileStones (msID int, msLabel varchar(50), msPlannedStart date, msActualStart date)
INSERT INTO prjMileStones VALUES
(1, 'Milestone 1', '2018-10-30', '2018-12-13'),
(2, 'Milestone 2', '2018-11-12', '2018-12-10'),
(3, 'Milestone 3', '2018-10-21', '2018-12-25'),
(4, 'Milestone 4', '2018-10-18', '2018-11-28'),
(5, 'Milestone 6', '2019-01-08', '2019-01-29')
OK, Now let's start the report...
Create a new empty report then add a dataset with the following query
SELECT
*
FROM prjYearMonth d
LEFT JOIN prjMileStones t on (d.Year = YEAR(t.msPlannedStart) AND d.Month = Month(t.msPlannedStart))
or (d.Year = YEAR(t.msActualStart) AND d.Month = Month(t.msActualStart))
Now add a matrix item to the report. Add a Row Group that groups on msLabel.
Next add two Column Groups. First a group that groups on Month and then add a parent group that groups on Year.
Add columns on the row group so that you end up with 4 columns msID; msLabel; msPlannedStart; msActualStart.
Finally (for now) set the Expression of the Month field (the one in the column header) to be
= Format(DATESERIAL(2017, Fields!Month.Value, 1), "MMM")
This will just give us the month name rather than the number (the 2017 is irrelevant, any year will do). Now just format as required.
You report design should look something like this..
If we run the report now we will get this..
Now to plot the dots...
For this we will create a small subreport. The subreport will accept 3 parameters. Year, Month, msID (the milestone ID from your main table). We will need the data in a slightly different structure for this sub report but the work can be done in the dataset query so nothing new is required in the database itself.
So, create a new report, let's call it _subMonthChart.
Next add a dataset with the following query..
DECLARE #t TABLE(msID int, msLabel varchar(50), PlannedOrActual varchar(1), msStartDate date)
INSERT INTO #t
SELECT msId, mslabel, 'P', msPlannedStart FROM prjMileStones
UNION ALL
SELECT msId, mslabel, 'A', msActualStart FROM prjMileStones
SELECT
1 AS Y, Day(msStartDate) as Day, PlannedOrActual
FROM prjYearMonth d
LEFT JOIN #t t on (d.Year = YEAR(t.msStartDate) AND d.Month = Month(t.msStartDate))
WHERE [Year] = #Year and [Month] = #Month and msID = #msID
Your report should now have 3 parameters that were automatically created, edit all three to Allow Nulls.
Note: The Y in the dataset is just some arbitrary value to help plot on the chart,. I will set the Y axis to range from 0 - 2 so 1 will sit in the middle.
Next, add a line chart with markers. Don't worry about the size for now...
Set the Values as Y
Set the Category Groups as Day
Set the Series Groups as PlannedOrActual
Right click the horizontal Axis, choose properties and set the Axis Type to Scalar, switch off 'Always include zero' then set Min = 1, Max = 31, Interval = 1, Interval Type = Default.
Note that for data in months that don't have 31 days the plots points will not be accurate but they will be close enough for your purposes.
Right click the Vertical Axis, choose properties and set the Mn=0, Max=2, Interval = 1, Interval Type = Default
Next, right click on one of the series lines and choose properties. Set the marker to Diamond, the marker size to 8pt and the Marker Color this expression =IIF(Fields!PlannedOrActual.Value = "P", "Blue", "Green")
The report design should look something like this... (check the highlighted bits in particular)
Now let's quickly test the subreport, based on my sample data I set the parameters to 2019, 1 and 5 and get the following results....
As we can see, our two dates that fall in January for this milestone were plotted in roughly the correct positions.
Nearly there...
Next right click on both Axes and turn off 'Show Axis' so we hide them.
Now resize the chart to something that will fit in the main report cell. In my example I set the size to 2cm, 1.2cm and moved it top left of the report. Then set the report to be the same size as the chart (2cm,1.2cm again in my case).
Save the sub report and go back to your main report...
For the 'Data' cell where the rows and columns intersect, set the size to match the subreport size (2cm, 1.2cm) then right click the cell and insert subreport.
Right click the newly inserted subreport item and choose properties.
Choose _subMonthChart as the subreport from the dropdown.
Click the parameters tab. Add an entry for each parameter (Year/Month/msID) and set its value to be the corresponding field from the dataset.
FINALLY !!!! Set the border on the cell containing the subreport to have borders all round, just so it matches your mock-up..
Your report design should now look like this...
Now when the report runs, it will pass in the month, year and milestone ID to the subreport in each cell which in turn will plot the dates as required.
When we run the report we should finally get this...
This may need some refining but hopefully you can get this going based on this. If you have trouble I suggest you recreate this example in its entirety, get it working and then swap out the database parts to fit your current database.
I am working on a SSRS Report and I have two Parameters in the Prompt section, EmployeeID and EmployeeName respectively.
EmployeeName prompt depends on the EmployeeID prompt selected, can the EmployeeName be populated in a textbox once EmployeeID is selected.
Right now EmployeeID is being shown in a drop-down and the user have to go to the drop-down and select it, can it be done in a textbox?
Any help would be greatly appreciated!
Create your main report dataset (dsMain for exmaple) with a query something like
SELECT * FROM myTable WHERE EmployeeID = #EmployeeID
I'm assuming you have the first parameter setup and working correctly to return your list EmployeeIDs. For this example we'll call this parameter EmployeeID/
Create another dataset (called for example, dsEmployeeName) with a query something like
SELECT EmployeeName from myEmployeeTable WHERE EmployeeID = #EmployeeID
In the second parameter (the one you want showing in a text box), leave the 'Available Values' blank and set the 'Default Values' to be from a query. Choose dsEmployeeName as the dataset and choose EmployeeName as the Value.
NOTE This will only work the first time round. If you choose another value from the drop down, the name will not be updated.
I don't know your exact requirements but if you can get both the ID and name together, why do you need two parameters, one of which does nothing really as it's not passed to the report?
I have 2 tables which both have the column "countyID"
I have a main report that brings up reports based on a query like:
SELECT countyID, name, address, state
FROM TableA
---I have a parameter set on TableA where you select the Name to view its report.
I then have a second report based on a query like:
SELECT *
FROM TableB
I want to use the second report as a subreport, as in, when you select the Name for the top report it should then list all records from TableB with the same CountyID.
Is there a way to set countyID as a parameter and then pass it to the subreport? This way the subreport would always only return records with matching countyID's to the currently selected record of the main report.
I'm assuming that you've created a drop-down #Name parameter to load into the DataSet you're using for TableA. You've configured this Parameter to specify its values from the Name field of your TableA DataSet, which likely uses a query similar to:
SELECT CountyID, Name, Address, State
FROM TableA
WHERE Name = #Name
You would then need to create another parameter to store the relevant CountyID values from that DataSet, e.g. #CountyID. Set it to 'Hidden'. For the Available Values and Default Values, point it to the same TableA DataSet, but have it use the CountyID field for its values/labels.
You'd then need to pass the #CountyID parameter into your subreport. The DataSet for this tablix should be, like you outlined:
SELECT *
FROM TableB
WHERE CountyID = #CountyID
Are you sure you're using a subreport for this, and not just another tablix? The reason being, if you are using a subreport, you would need to open the subreport report object and create the #CountyID parameter on there as well, assuming that is where the TableB DataSet is. Set it to Hidden but don't worry about setting any values, since it will received from your Main report.
Lastly, go back to the original Main report, right-click on the subreport box that you dragged onto your report body, and go to Properties > Parameters > Set Name to CountyID , and the Value as [#CountyID] .
**Note: In SSRS, parameters have the annoying trait of being case-sensitive. It's always good to keep this in mind sooner rather than later in report development.