SSRS only apply parameters to certain fields or exclude LookUp/Expressions? - reporting-services

I have a report that displays employeeID, employeeEmail, supervisorID, and expirationDate. I then use this LookUp function to find the supervisor email:
=Lookup(Fields!supervisorID.Value, Fields!employeeID.Value, Fields!employeeEmail.Value, "DataSet1")
The problem occurs when I set parameters for specific date ranges on the expirationDate
expirationDate >=#startdate
AND expirationDate <=#enddate
This narrows the search result to only show employees with an expiration date in the date range. However, it also filters out my supervisor email address if the supervisors expirationDate doesn't fall within the range as well.
I don't want the LookUp expression to be subjected to the parameters of the date range. I want the supervisor email to always show. Because the date range parameter is meant to filter out the employees by expiration date, not the supervisors.
So when the employee is displayed because their expirationDate is in the range, their supervisorID should always be displayed, but because the LookUp expression then re-queries the dataset to find the email, the results are being blocked when the expirationDate isn't in the range for supervisors too.
Is there a way to exclude my LookUp/Expression from the parameters? Or for the parameters to only filter out specific column fields?

So you're filtering "DataSet1" on the Dates too? You should just be able to remove that filtering so that the dataset contains all the email addresses available to be looked up. This won't affect which supervisors are shown in the report since presumably the content is coming from a different dataset than DataSet1 and that's why you're using lookup!

Where are you specifiying the date range filter? If it's on the dataset then there is no way for the lookup function to reference rows that are not included in the dataset. One possibility is to add the date filter to the table (or whatever data region you're using), thus leaving all rows in the dataset to be referenced by the lookup function. This is an ok solution for small data sets but obviously doesn't scale well if the unfiltered dataset is very large.
A better solution in general would be to retrieve the supervisor details for each row in your dataset, by editing the query to do the join between employee and supervisor. This will be more efficient and you can then filter the dataset on employee dates and forget the lookup function, which means less work for your report to do.

Related

SSRS - Issue with Cascading Parameters Selection Refresh

I have cascading parameter that contains list of employees that produced reports for a certain date period. The parameter Employees is multi-select list and it's cascading parameter, i.e. depends on Beginning & Ending date parameters, so only employees that were active in this period will be displayed in the dropdown.
Here is the issue - when I modify dates to a longer period, my Employee list expands (so refresh happens correctly), but among all employees only those are selected, which were part of previous list, before changing beginning/ending date parameters. I need Employee list always to be SELECT ALL by default. SELECT ALL option does appear in the list, but it's not being selected after the refresh.
This SELECT ALL requirement is important as users may run report assuming all employees are selected, which in fact will not be the case, so current functionality is very misleading.
For your knowledge, default values for the Employee list are the same as Available values - getting list of employees from DB query based on period specified.
Appreciate your help on this matter.

SSRS Report Subscription Data Filter

I am working on a SSRS report that I will be subscribing through an email which should render as MHTML. However, many times, the report has too many records, which leads to the following error - Exceeds Max MIME Parts Per Message. So, is it possible to restrict number of rows or pages that I can send through the report via an email. I don't see any option for the restriction.
No, there isn't an option to restrict the number of records for a subscription so why don't you create one?
Create a parameter called LIMIT with a Yes/No selection and default to NO. For your subscription, set the LIMIT parameter value to YES.
Add a Filter to your Dataset based on your parameter.
For the Expression, you need a unique value - whether it's an ID field or combination of fields. Equal values will only be counted ONCE.
For the Value expression, if the LIMIT is Yes then use the number of records that will fit in the email. For the else, use a large number - more than you would ever expect in the report.
=IIF(Parameters!LIMIT.Value = "Yes", 100, 1000000)
MS Docs - Filters

Sort differing date formats in Access?

I have an Access database in which a report is pulled and displayed based on city and state. There is a form where the user selects city and state and a query is run, then a report displayed based on that query. I want to sort the data from the query by Warranty Start date(WSD) then Model #. The problem is that all of the dates aren't in the same format and if I try to format the WSD column as a date field Access Deletes at least 1000 records. Currently all fields are formatted as short text. Is there a way that I can sort the data by date without the format being the same for all? I have attached a screenshot of some records to show the issue.
If you need the sql query I can provide that as well.
If you wish to sort by the date, then you can use:
IIf(IsDate([WSD]), CDate([WSD]), DateSerial(Val([WSD]),1,1)) AS WarrantyDate

SSRS Report - Subgroup Totals

I have an SSRS report that is currently pulling a single dataset. This dataset contains records of inventory we have. Each record is a separate asset.
I want my report to group by a certain field, and then subgroup by certain criteria that are determined with a couple different fields. Basically there is one parent group, and three adjacent subgroups. My grouping functionality is working correctly, however I am finding it difficult to add totals to each of the adjacent subgroups. When I add a total, it is totaling the specific field within the scope of the entire dataset, instead of limiting the total to just that subgroup.
How can I add totals per field within subgroup?
EDIT: Added sample data and explanation:
You can ignore the function code field, that is what I am using to group on the parent group.
asset number,description,first year,acquisition cost,function code
190,random asset,2008,5000,100
193,random asset45,2008,56000,100
197,random asset26,2014,3000,100
191,random asset27,2014,7000,100
192,random asset36,2013,15000,100
I can't seem to attach screenshots, so here goes..
In the report you can see three subgroups; Assets, AssetAdditions, AssetDeletions. In the tablix, you can see where these groups are positioned. You can also see a row directly beneath the group that is supposed to total the subgroup at the end. However, for some reason the scope is only taking into account the entire dataset. I have tried to modify the expression in the Sum function [Sum(acq_cost), "Assets"], adding in the scope parameter but then it does not allow me to even run the report. It yells at me saying that "Assets" is an invalid scope.
The easiest way I have done this in 2012 VS is to have it return as part of the data set and have it sum up the value.
For instance if you have a quantity for inventory, and you have a subset where you only want the total quantity for that set, you add another column to your dataset called TotalSetQuantity and the subtotal field will have the expression =SUM(Fields!TotalSetQuantity.Value) rather than =SUM(Fields!Quantity.Value).
You can try iif statements within your report like =sum(iif(Fields!ColA.Value=1,Fields!Quantity.Value,0) but I had some troubles getting that to work.
Hope that helps, I ran into this issue this past week and the first option worked like a charm for me.

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.