Paginated Report-Date Parameter Range - powerbi-paginated-reports

I am using Paginated Reports against a dataset published in the cloud. I click on Query Designer to drag all the columns to the page and build my query parameters (i.e, not report parameters). When I add my date parameter, I have options in the dropdown of 'equal to', 'not equal to', 'contains', 'begins with.', 'range(inclusive)', 'ange(exclusive)', and 'Custom'. I want the date parameter such that when the user selects a date in the parameter prompt, the query returns 13 months of data, ending on the date they select in the parameter, so if they select 10/31/22, the results will be 10/31/21 thru 10/31/22. I don't want the user to have to enter a start and end date range if I don't have to. Given the parametr options I have, I don't see how to do this. I thought about modifying the code of the resulting query statement (it begins with EVALUATESUMMARIZECOLUMNS). I see logic in the code that says 'RCustomDaxFilter(#Date,EqualtoCondition'. I thought about changing the 'EqualtoCondition' to something like 'Between', but nothing works. Thanks for any assistance!

Related

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!

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

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

Custom tablix filters in SSRS

I have a report which displays a table full of raw data.
Prior to entering this report, the parent report asks you to select a 'Service' & 'Department'
Depending on which Service/Department you select from the parent report, this RAW data will be filtered to show the relating data.
Straight forward enough, and it works, great.
I have a new requirement now.
If the chosen Service is equal to 'Service X' I need the data to be filtered again on that Service, department, but also to add aditional filter, on their 'team'.
so that the data will also be filtered where the team matches the user running the report's team.
I have a dataset already created which returns the user running the reports 'team'
And also a new parameter called 'team' which defaults to the user running the reports AD number'
The new requirement is, if the Service = X, then filter the data on the department but also on THAT users 'team', if the Service is not equal to X, do nothing.
I think I need to alter the Filters section of the Tablix Properties but am not sure what I need to put in the Expression, Operator, Value
So far I have tried =IIf(Fields!Service.Value = "Service X", Fields!Team.Value, nothing) in the Expression, set the Operator to In and tried filtering on the 'team' from my new dataset which stores the current users 'team' but it is not working.
Does anyone have any suggestions?
For these sorts of conditional filters I've had best results with using the IIf statement (or whatever) to return a string and filtering based on that, e.g. something like:
=IIf(Parameters!Service.Value <> "Service X" or Parameters!Team.Value = Fields!Team.Value
, "Include"
, "Exclude")
Then you can set the Operator to = and the filter value to Include. Just seems to a bit more robust in my experience.
Reading over this, you could even set the IIf statement up as a Calculated Column in the dataset and filter on that.

Fields cannot be used in report parameter expression

I have to set the start_date of my report depending of a report parameter. The time stamps are calculated in a database query.
My expression looks like this:
=SWITCH (
Parameters!report_type.Value = 1,First(Fields!daily_start.Value, "Timestamps")
,Parameters!report_type.Value = 2,First(Fields!weekly_start.Value, "Timestamps")
,Parameters!report_type.Value = 3,First(Fields!monthly_start.Value, "Timestamps")
)
Unfortunately I get the error message:
A value expression used for the report parameter 'time_from' refers to a field. Fields cannot be used in report parameter expression
I know, that this is not allowed because SSRS cannot be sure in which order datasets are called. But I think this is not dangerous.
All time stamps are received by query without parameter. The parameter report_type is selected by a user before the report will be generated.
Can someone give me a hint for a workaround?
Here's the workaround - get the value using SQL.
Create a new Dataset called StartDates:
SELECT CASE
WHEN #report_type = 1 THEN daily_start
WHEN #report_type = 2 THEN weekly_start
WHEN #report_type = 3 THEN monthly_start
END AS StartDate
FROM MyTable
You already have the #report_type and #time_from parameters. With the #time_from parameter, set its Default Values to Get values from a query using the StartDates dataset and the Value field StartDate.
Now, you'd think this might be enough to make it work - you're referencing this query as the default value and as you change the #report_type parameter the other parameters refresh, but the first date in the #time_from parameter never changes. That's because the refresh happens on the Available Values query, not on the Default Values query.
So you also need to wire up the Available Values query to the StartDates query. Now your query will fire on the change of #report_type and the default value will be set to the appropriate date for your selection.
I switched from a query to Stored Procedure and was getting this error. Things I tried:
Ensured I had sufficient permission on the database (you need EXEC rights or DBO to run teh sproc)
Delete the existing parameters (and then use refresh fields to refresh/get the correctly named ones back)
Remove the square brackets around the stored procedure if you've specified that
Sometimes, Expressions can get a bit verbose. I have created a Report Code Function and then used that as the Parameter Value.
For example, I created a Code function called "CalculateDateSet" and then set the Report Parameter to this expression:
"=Code.CalculateDateSet(Parameters!Month.Value, Parameters!Year.Value"

Parameter missing a value

I am new to reporting services and have a reporting services 2005 report that I am working on to use as a base report template for our organization. I am trying to place the date that the report was last modified on the report server into the page header of the report. However, I keep getting a 'ParamX' parameter is missing a value error when I try to This is what I have done:
Set up a Parameter ReportName with a default value of Globals!ReportName. It is also hidden and internal.
Set up a Dataset ReportHeader that calls a stored procedure that returns the date the report was last updated or another date, if the report is not on the report server. It has a parameter #ReportName assigned to the Parameter!ReportName.Value. The Dataset returns values when run on the dataset tab in the BI tool.
Set up a Parameter ReportVersion that has a default value Query From based on the dataset ReportHeader and picking the ModDate column. It is the last parameter in the report parameters list.
I assign a textbox to the parameter.
When I preview, I get "The 'ReportVersion' parameter is missing a value whether I place it in the report body or page header (which is where I want it). I have deleted and added the parameter again, toyed with the hidden and internal settings on it.
What does this error really mean, what I am missing, and can I even do this with parameters?
Thanks In Advance
Jim
If I understand what you're doing, it sounds like you want to be using a field where you're implementing a parameter...
You are returning the ModDate from the data source, correct? If you're doing this, you can simply throw a text box in there, and use something like this: =Fields!modDate.Value to display it.
Parameters are values that go in to the query, fields are what it returns.
Hope this helps...
EDIT:: OK so are you trying to retrieve the mod-date column value from the reportserver db? If that's what we're talking about, you'll need to add a few things to the report. Add a datasource to report db, a dataset containing the date (query below), a list object in the report linked to the dataset, and a textbox in said list object to display the field. If you hit the report server with a query like this:
SELECT MAX(ModifiedDate) AS ModDate FROM catalog WHERE name='myReportName'
That will return your modifieddate from the ReportSErvices Database as a field that you can use.