Passing multiple values to subreport parameter - SSRS - reporting-services

I have a report that has 4 parameters:
Year - accepts a single value for a year - ex: 2020
Carrier Group - allows the user to select a single carrier grouping
Segment - allows the end user to select one or multiple business segments
Loss Cause - allows the end user to select one or multiple loss causes
And when I execute this report:
The report generates as expected - and I have the SSRS report set up so it creates a new tab in Excel when exported to separate the monthly totals vs the cumulative totals.
But the end users would like to be able to execute this report for multiple years to compare - so I have created a parent or main report - then I created a tablix and added the sub-report to be called - and created a row group based on the Year(s) selected.
My subreport parameters are as follows:
What I am ultimately hoping to accomplish is to pass in a single year plus the carrier group, segments and loss causes that were selected - and run the subreport for each of the years the user may select.
For example, if the user selects 2016, 2017, 2018 - the sub-report would need to be run 3 times to generate the totals for each of those years using the same parameters for carrier group, segment and loss cause.
I'm not sure what is happening but with the Year parameter as it: =Parameters!Year.Value(0) - the report looks like it keeps generating one year over and over:
I also tried using =JOIN(Parameters!Year.Value,",") but that did not seem to help either.
Anyone have experience on how to solve this type of issue? Thanks,

The easiest way to do this is to add a dataset to your main report that returns one row per year.
If you have a dates table or similar in your database then you could do something like
SELECT DISTINCT Year(myDateColumn) as [myYear]
FROM myDatesTable
WHERE Year(myDateColumn) IN (#Year)
If you don't have a date table then (other than suggesting you add one...) you could create one on the fly with something like
SELECT * FROM (
SELECT top 20
ROW_NUMBER() OVER(ORDER BY name) + 2000 as [myYear]
FROM sysobjects) o
WHERE myYear IN (#Year)
(adjust the top 20 and +2000 as required to get a range of years that covers all your potential data)
Now set the dataset property of the tablix in your main report to point to this new dataset.
In your subreport object's parameters, set the value for the Year parameter to the [myYear] field in your dataset by selecting it from the drop down or using =Fields!myYear.Value as the expression.
Now that the tablix is bound to the dataset, it will create one row for each record returned from the "dates" dataset, each row will have a different year which is passed to the subreport, so the subreport is called once for each row/year.

Related

Dynamic graphs at ssrs

I need to develop report at SSRS include pie chart, that based on dataset (the dataset can change every day)
Can I make "dynamic pie" on report that change the number of graphs according to the dataset I define?
[A particular day can have 2 employees (2 pie graphs) and another day can have 5 or more employees (and therefore need 5 different graphs)]
For example:
This is the report that I need, based on this dataset
Requested report
My_Dataset
Thank!!
Yes, this is a brief overview of the main steps...
You will need two reports.
The first will be a subreport. So build a report that takes one or more parameters, based on your sample data the parameter would be Emp_Name. Build this report that it can handle a single employee only. The dataset might be something like SELECT * FROM myTable WHERE Emp_Name = #Emp_Name
Once that is complete, create a second report. Add a dataset that contains just a list of the employees so something like SELECT DISTINCT Emp_name FROM myTable ORDER BY Emp_Name
Add a list or table to this report and set the dataset to the dataset you just created. In the list (or table) right-click inside the cell and "insert => Subreport". Set the subreport to be the first report you created. and the parameter to be the EMp_Name field from your dataset.
When you run the seconds report it will create one row in the list for each employee in the dataset, inside each row it will run your subreport and pass the respective paramater.
That's it really.
Note that this will produce a vertical list but it should get you started. There are plenty of examples of how to arrange horizontally.

linking a subreport to a main report and have the data in the table match in SSRS

I am trying to take a report that has employee pay data for a specific date range. It works fine. My problem is I need to take and put in YTD data of hours worked and total paid from the beginning of the year to the ending date parameter. I created a subreport that gets me that data. What I am having trouble with is getting the subreport to return the data, per employee, in line with the main data. When I used Crystal Reports I could link the main table to the subreport without creating parameters. Not sure if there is an equivalent or a work around. Thanks in advance
Mike

SSRS Line Chart--One line defined by a parameter (a subset), one line an overall average (parameter independent)

I am new to SSRS 2008R2 reports, so this may or may not be easy, although it should be very basic. Here is a table of what my data looks like in the query designer:
You can see that Provider.ProviderName (the Pro... column in the picture) is a parameter as well as the beginning and ending months. It is straightforward to add a line to a line chart depicting the No Show Value for the provider selected in the drop-down menu for the report (each month is one data point, typically for 12 months). But I cannot figure out how to add a line that shows the monthly average No Show Value across all providers, for the same selected time period, no matter what Provider is selected. Any ideas?
I would keep the Provider parameter definition in SSRS but unlink it from this dataset, so that it returns the results for all Providers.
Then in the existing Values entry (representing the Selected Provider), I would add an Iif function to return Nothing unless the Dataset Provider Field matches the Parameter provider.
Then I would add a new Values entry (series) for the Average No Show Value which will aggregate across all Providers.

SSRS 2008 R2 - Repeat textbox/table on all pages

I have a report in SSRS which basically contains a table of dates and blank columns for users to print and then manually write data into.
The report has a #FromDate and a #ToDate parameter as well as a #Location parameter.
The #FromDate and #ToDate parameters are used to populate a table with dates and is grouped per week (Mon to Sun) with a few extra columns that are blank for manually writing data. Above this table there is a textbox containing employee name.
What I am trying to do is to get the employee name to change for every page according to the #Location parameter. So if a location has 10 employees I need 10 pages with the different employees names at the top so 1 page per employee. The main table with the dates should repeat but the data will be exact on each page, basically the only thing that will be changing is the employee name at the top of the report.
Currently I have tried creating a table with just a header and adding the employeename field into the header but it only returns the 1st employee within the dataset and only returns 1 page when there should be 26.
What would be the best way to achieve this? It seems simple enough in theory but can't get it to do what I need.
A rough outline:
Create a subreport that shows your calendar. It will take the two date parameters.
Create a parent report.
The dataset in the parent should return a list of Employees for the selected location.
Create a table for that dataset, and put two detail rows in that table. The first will just have Employee name.
Test at this point and see that you just get a list of employees.
Place your subreport in the second detail row, and set the parameters to be handed through.
Change the properties of the detail group to have a page break between instances.
If you let us know what isn't working for you, we can give more specific advice.

Creating a report with SSRS that iterates over a parameter

I am modifying an existing report which is setup to let you view statistics per sales rep. You do this by changing the parameter sales rep in the report view.
I need to modify the report so that it can display a page for each sales rep. This will then be exported to Excel with each sales rep statistics being displayed in a separate tab.
I have researched this and found people talking about iterating over a report but I don't think that what they are referring too is what I am asking:
http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/27ffabcc-6286-4fed-a8bf-0e5d78560be3
http://jameskovacs.com/2005/08/04/digging-deep-into-reporting-services/
You can accomplish this several ways, so here is 1 suggestion
Create a new tablix report whose query returns a (unique) set of all sales reps
group by sales rep
there is no detail row, but in the group footer/header add a subreport
the subreport will be the report you already are using and it's parameter will be the sales_rep value from your main report query
set page breaks for the group
The main way I can think of doing it is to pass the parameters into the stored procedure, and in there have logic to UNION together all the possible results you want with a field for grouping the sections.
For example if they had a parameter for "Report Sections" and had selected "1, 2, 3", then you pass the parameter to the stored procedure; inside it uses a SplitString routine to convert the commas into a table format, and then constructing another temp table to hold the results. Everything is accumulated into there with a SectionNumber field (1, 2, 3, etc), and then the whole lot gets returned. Your group groups on that, with page break set, and that's it.