Calling a detail report using the intersection of Row and Column Sum as parameters - reporting-services

Description:
I have a report that that aggregates ATM transactions. This report has a Tablix with the following attributes:
Rows;
Vendor, Terminal.
Columns; Month, Day (Date), Hour.
The Row groups Terminal as child of Vendor and the Column groups Hour as child of Date and Date as child of Month. The Row Group and Column Group properties specify that each child visibility is toggled by its parent and the default if each child visibility to be hidden.
The Placeholder Value property for the intersection is set to Sum() transactions. The Action is set to Go To Report and specifies a detail report that accepts;
Start Date,
End Date,
Vendor,
Terminal
As parameters to the detail report. Each time the link is clicked, it calls the detail report with the dataset parameters set at runtime. So, for “North”, the detail report would reveal 41765 rows associated with the vendor “North”.
Problem:
No matter what resolution of detail in the matrix, when clicking the Sum() value to invoke the detail report, the dataset parameters set at runtime are sent to the detail report. For instance, if I drill down from Month to Date, I see that for Vendor “West” the sum of transactions on 2018-07-01 are 81. If I click that link to summon the detail report, it returns the total rows for the Start Date and End Date (1577 rows), rather than for the Date (81) as expected. This behavior is replicated throughout the intersection combinations.
Request:
How do I call up the detail report such that it returns only those rows specified at the resolution of the intersection in its current state? Ie: the sum at Month\Date: Vendor or the sum at Month: Vendor\Terminal or the sum at Month\Date\Hour: Vendor\Terminal….
What is the best method to accomplish the request? My research has not come up with any valid suggestions. I've attempted to use InScope() in the Placeholder Properties expression but can't seem to get it right.
Thanks for your help!

Your thought is correct, you have to use Inscope
Step 1:
For each parameter you use in your main report to call the subreport use an expression like
= Iif( Inscope("matrix1_Terminal"), Fields!Terminal.Value, Nothing)
For numeric parameters (like month number) set a dummy value like -1 because NULL values are not allowed
= Iif( Inscope("matrix1_Month"), Fields!Month.Value, -1)
Step2:
In the subreport change your parameters to accept NULL values (only for strings and dates)
Step3:
On the subreport adjust your query code to handle dummy parameter values
For string or dates
WHERE (terminal = #Terminal or #Terminal IS NULL)
For numeric values
WHERE (month = #Month or #Month=-1)
Important!!
Don't forget to pass to the subreport other parameters needed like filters in the WHERE of the original report
Tip: In the subreport use temporary string parameters for debugging and pass the values of your Inscope expressions

Related

How to get a value of cell based on condition from 2nd group in same tablix in RDLC report

I am working with RDLC report, where I have a very specific customer requirement to print a summary at the end of Report.
Please refer to image below for clear understanding:
Report summary is generated based on two Groups: Resource (No), and Task Wage Type.
1st tablix group = No.
2nd tablix group = Task Wage Type.
I need to generate an average per resource where:
Average = Total Cost / Quantity (where Task Wage Type = Hourly Task Wage)
So, I am working on extracting the value for Quantity where Task Wage Type = Hourly Task Wage and show it in Total Column for each group.
How can I achieve this?
Currently I have written this expression to achieve results, but its throwing an error as shown in picture above
=Sum(CDec(Fields!Total_Cost.Value), "Resource_No1")/Sum(IIF(UCase(Fields!WT_TaskWageType.Value)="HOURLY TASK WAGE", CDec(Fields!Quantity.Value), 1), "Resource_No1")
Finally my RDLC tablix image is shown below where I have two groups
How to resolve this error?
I can't see too much wrong with your expression so I would try to simplify things and build each part of the expression up until you get an error.
Two points though...
You should not need to specify the scope "Resource_No1" as it appears that the textbox is already within the correct scope (it's in he Resource_No1 group's rows).
Also, you appear to be adding 1 into your sum amount when the task wage type does not match your criteria. You should use 0 or nothing there instead I guess.
You could just try this to start with and then if that does not work, build up each part of the expression slowly.
=Sum(Fields!Total_Cost.Value)
/
Sum(IIF(UCase(Fields!WT_TaskWageType.Value)="HOURLY TASK WAGE",
Fields!Quantity.Value,
Nothing)
)
If you still get errors, try returning just the second part of the expression and see what you get.
I just tried this on a similar setup and it worked as expected.

SSRS Report Parameter Issue

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!

Populate a parameter dropdown based off another parameter

I am trying to populate a dropdown based off another dropdown parameter. I have 5 parameters, but the first 3 populate the 4th in the report. So the 4th and 5th parameter are what the user uses to populate a report. So the 4th parameter (meetings) has a meetings dataset and the 5th parameter is meetingType with a dataset of meetingType. So when the user selects a meeting, then the meetingType gets populated by that selection. Currently both dropdowns produce all results, which I don't want. I just want all results for meetings and then the meetingType gets populated by meeting.
The table it produces once the report is ran doesn't use those properties and there isn't a place to query anything. I can only use available values from each dataset and not use available values based on the selection of the 4th parameter.
I'm not really clear. do you need a parameter or do you just want to have the meeting type available as a value in your report output?
Fairly straightforward. You have two datasets, one for each parameter. You need to filter the second dataset based on the first parameter.
For example, I often create reports that ask for a range of values, let's say programs. Once the user has entered the beginning value, the ending value must be greater than or equal to the beginning value. So, on the ending value dataset I create a filter. In this case, the filter says that the field code (which is my program) must be between the starting parameter and the maximum value allowed:
You can make your filter as complex as needed - referring to the other parameter with a formula
You can also do this via separate datasets for each parameter.
Lets say you have two parameters #param1 and #param2
you want the values on #param2 to change based on #param1 selection.
You will have your main dataset (main_dataset) with a where clause something like this
where sometable.somecolumn = #param1
and sometable.someothercolumn = #param2
Now you create a dataset (param1_dataset) for #param1 which brings back all the values you require for this parameter
Now create another dataset (param2_dataset) form #param2 and add a where clause to it which restricts the returned list.. something like this..
where sometable.somecolumn = #param1
Now on your report parameters.. set the Available Values for each parameter (report parameter properties) to "Get Values from a query" and select the appropriate dataset and the value field and label field (returned by the dataset) for each parameter.
Now when you run your report, your parameter selection 2 should change based on what you selected for parameter selection 1

SSRS report pass multiple VALUES to drill through report parameter

I created a report with 5 fields in a hierarchical order:
Order Date
Time of Day (AM/PM)
Parent Name (aka customer)
Product Line
BIC Part Number (aka Item)
Each field expands down to the next level, so order date expands to time of day, etc.
I want to create a drill through report so that the user can click on each level of the hierarchy and see the detail.
This works fine at the lowest level - Item - because only 1 values from each field has to be passed to the drill through report parameter. However, when I try, for example, to drill through based on Product Line, there will usually be 3 or 4 Items within this product line. In the Go To action, I have the drill through parameter "bic_part" set to the main report FIELD value "BIC Part Number".
I have the tablix on the drill through report set where "BIC Part Number" IN [#bic_part].
I just want to be clear, I am passing a set of report field values to the drill through report parameter, not parameter to parameter.
I have tried using expressions with =Split(Join(field value),","),",") and all variations on that. I can't seem to get the child report filters to accept multiple values from the BIC Part Number field from the parent report.
I also tried omitting the BIC Part Number value in the go to report section, but it would not let me.
All of the parameters in the child report are set to accept multiple values. My data source for both reports is the same stored proc, so I can add a query filter. I would appreciate any help.
I think each sub report link needs to be slightly different.
In the subreport, each parameter needs to accept null and your query needs to look for
(FieldName = #FieldNameParameter or #FieldNameParameter is null)
This will allow you to pass the lowest possible solid value, then null for all child values.
If we're looking at the Parent_Number level, on that subreport link you would pass Fields!Parent_Number.Value and then Nothing for each of the lower parameters (Product_Line, BIC_Part_Number).
This will allow you to filter on the lower common denominator in your sub report - Part_Number for this link, Product_Line for the next one down, etc.
I've used this logic in reports before, so it does work. Let me know if my explanation needs clarification - it's Friday afternoon..

SSRS report parameter : parameter's value change upon other parameter's value selected event

Here's my scenario,
I have a report in which it has two subreports in it.
each subreports visibility depends on a parameter(A) value.
each event for selecting the parameter(A) value from all available value will refresh other two parameter's(B,C) list of available value with same set of data but different than before the refresh event.
B and C will use one value from the list as its default value.
default value is controlled by expression in default properties of B,C
when A is changed again, cycle repeat.
A, B and C are used to specify date range for query.
A is selection to choose from two options ('WEEKLY','MONTHLY'). The default is 'WEEKLY'.
'WEEKLY' will return list of work week in current year to B and C. subreport1 displayed. subreport2 hidden.
'MONTHLY' will return list of month in current year to B and C. subreport1 hidden. subreport2 displayed.
and expression for default value of B and C is =IIF(Parameters!A.Value = "WEEKLY",datepart("WW",today()),IIF(Parameters!A.Value = "MONTHLY",datepart("M",today()),0))
Now when it loads, A is 'WEEKLY', B and C have correct default value datepart("WW",today()). Then...
I change A to 'MONTHLY', B and C got monthly data right and have right default value.datepart("M",today())
I then change back to 'WEEKLY' B and C got correct weekly data but still retain the default value from the first switch (which is datepart("M",today()) rather than supposed value datepart("WW",today()))
How do I get B and C to get the correct default value per category selected from A?
EDIT:
all subreport have same set of parameter as main report.
im using query to get the list for B and C.
so far query is working fine producing the list.
query is a procedure which take in parameter A then returning recordset of whether work week or month in current year.
every subreport have same parameter definition as in main report.
i actually doesn't know much how to use subreport. try and error here.
so when ssrs prompt me about some parameter definition is not defined for some subreport i matched parameter in subreport to parameter in main, at parameter tab of subreport properties.that's the only error i got through when building this report.
So after a bit of faffing I have managed to reproduce and the behaviour you require from our parameters. Apologies if this goes over ground you have already completed, or doesn’t work, but it behaves as expected for my configuration (SSRS 2008 R2).
Parameter A is set up with available values of “WEEKLY” or ”MONTHLY” for both the Label and Value, with a default Value of “WEEKLY”.
Parameter B is then set up with the available values’ for Label, Value and the Default values’ Value all set to your expression
=IIF(Parameters!A.Value =
"WEEKLY",datepart("WW",today()),IIF(Parameters!A.Value =
"MONTHLY",datepart("M",today()),0))
Available Values
Default Values
This is all repeated for parameter C
Now when I first run the report I am faced with the following
When I choose Monthly I get
Then when I choose weekly again I get
Only when I choose monthly and select "View Report" does the visibility change on the report
I'm not certain you filled out all these steps when you asked the question - you may have done - but it is worth giving the above a go from fresh and see if the behaviour is as you require
Any problems, let me know, and I'll try to help further