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.
Related
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.
I have a report which uses 3 datasets and on the report a am using Multiple Tables and Textboxes and expressions. When I run the report I have to select a Parameter which in this example is 'City'.
I want a new page for each City (parameter) , I have read to use page breaks and grouping but I selected a List from the toolbox and put that on top of my report, selected 2 'Cities' and expected it to return 2 pages but it returned 49 pages (majority blank)
I want a separate page per city how can I achieve this?
Thanks
If I understand you correctly (it difficult to be sure if you don't post your current design) then you would be better using subreports.
I'm assuming Cities are in a table in your database and each have a unique ID. If you only have the names then you can use CityName inplace of CityID and it will still work.
Create a new report.
Create new dataset (say dsSelectedCities and the set dataset query to something like ...
SELECT CityID, CityName FROM myCitiesTable WHERE CityID IN (#CityParameter)
This will automatically generate a report parameter called #CityParameter. Set the available values etc just the way you did in your original report, so if you need to add another dataset for this then do so. In this example I've assumed labels will be CityName and Values will be CityID. Whatever goes into the Values is what will be passed to our subreport.
Now add a table to you report, it only needs to be one column wide and one row long so just remove any other rows and columns just make sure you leave the detail row and not the header.
Set the dataset for the table to be dsSelectedCities
Make this remaining cell with wide enough to accommodate your subreport (which will be the report you originally wrote).
In the cell, insert a subreport
Set the subreport properties to point to your original report and set the parameter to the CityID field.
This table will act as a loop, for each record found in dsSelectedCities it will give us one row. As each row will have a single CityID we are passing that to the subreport, the subreport in turn just shows one City.
Set the page break option on the details group to break between instances.
You will probably have to modify your original report to accept a single CityID, it depends on how it was designed but hopefully this should get you going.
If this is unclear then post your current report design including all the details about parameters and I'll update the answer.
I have 'external' table.
Inside each row of this table I need to show several tables associated with different DataSets.
But I have no idea how I can constrain these 'internal' DataSets with parameters of the group.
Is it possible?
Update
The next step may be to show subreport.;) The problem is that when nested DataSets have empty results subreport is not shown... even static content.
Here is a nice post hot to force subreport to appear.
The idea is simple. You need to add fake DataSet to subreport with query like:
select ' ' as Dummy
and use the result in visible textbox like that:
=First(Fields!DUMMY.Value, "DataSetToForceSubreportVisibility")
It works like a charm.
Yes, this can be done with sub-reports.
1) Create a report, which contains all the "internal" tables you want for each row of the "external" table. Populate it with a dataset that has an ID parameter for which member of the outer group this is, so that all the internal tables will only be about a single group member.
2) Create a main report for your external table. This report contains a List control, and you populate it with a dataset that gets the members (IDs) of your outer group.
Inside each cell of the list is a subreport, which is the report you created in 1). You pass to the ID parameter of the subreport the field containing the IDs you selected for the List control.
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.
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.