Papa1NZ
asked on
SSRS - Date Parameter - Is it possible to have a multi select date range?
Hi Experts, I have a problem creating a parameter for a date range which now needs to be a changed to a multi select parameter.
I am using Report Builder 2008 R2. I am using the Filter tab in the report Builder.
I have a date field which indicates how overdue the payments are.
I need to have 4 date ranges between (today() and -30days), (-30days and -60days), (-60days and -90 days) and lastly (more than -90 days). I have this part working now but I now have to change this so that users can select a combination of the 4 date ranges. Is this possible??
If so how would I do this?
I am using Report Builder 2008 R2. I am using the Filter tab in the report Builder.
I have a date field which indicates how overdue the payments are.
I need to have 4 date ranges between (today() and -30days), (-30days and -60days), (-60days and -90 days) and lastly (more than -90 days). I have this part working now but I now have to change this so that users can select a combination of the 4 date ranges. Is this possible??
If so how would I do this?
Looks like the above answer is correct as far as populating the parameter list.
SQL expert ValentinoV wrote an article on SSRS Passing multi-value parameters that I'm about to do a deep dive into. Good luck.
SQL expert ValentinoV wrote an article on SSRS Passing multi-value parameters that I'm about to do a deep dive into. Good luck.
ASKER
Hi Tony / Jim.
Thank you for your responses. I should have mentioned this earlier but the application driver I am using to access the database does not allow me to use stored procedures and it has limited query syntax for the dataset. So I have to try and find a work around by using SSRS report features.
I would need to do this using the expression in the filter/parameter of the report builder / BIDS. Or/And use the 'Code' section. Is this possible?
What I want to do is have 4 labels.
(1) 'Overdue<30 days', (2) '-30days and -60days', (3) '-60days and -90 days', (4)'>90 days'.
What I did previously (Note: I didn't need the Overdue<30 in the earlier version) is create a Parameter which would create the end date required for the date range. When the users selected the label with e.g. '-30days and -60days' the system date minus 60 days would be passed as a parameter.
Parameter Label Expression:
=DateAdd("d",-30,Today())
=DateAdd("d",-60,Today())
=DateAdd("d",-90,Today())
With the date filter I used end date as the passed Parameter. For the start date I used the following expression:
=IIf(Parameters!OverDueDat e.Value=Da teAdd("d", -60,Today( )),
DateAdd("d",-90,Today()),
IIf( Parameters!OverDueDate.Val ue=DateAdd ("d",-90,T oday()),
DateAdd("d",-100000,Today( )), DateAdd("d",-60,Today()) ) )
This worked fine. However it now needs to be a multi select which will not work with the way I have created this filter.
Can you tell me other ways I might be able to create a multi-select range of dates?
Many thanks
Parameter-list.PNG
2FilterTab.PNG
Thank you for your responses. I should have mentioned this earlier but the application driver I am using to access the database does not allow me to use stored procedures and it has limited query syntax for the dataset. So I have to try and find a work around by using SSRS report features.
I would need to do this using the expression in the filter/parameter of the report builder / BIDS. Or/And use the 'Code' section. Is this possible?
What I want to do is have 4 labels.
(1) 'Overdue<30 days', (2) '-30days and -60days', (3) '-60days and -90 days', (4)'>90 days'.
What I did previously (Note: I didn't need the Overdue<30 in the earlier version) is create a Parameter which would create the end date required for the date range. When the users selected the label with e.g. '-30days and -60days' the system date minus 60 days would be passed as a parameter.
Parameter Label Expression:
=DateAdd("d",-30,Today())
=DateAdd("d",-60,Today())
=DateAdd("d",-90,Today())
With the date filter I used end date as the passed Parameter. For the start date I used the following expression:
=IIf(Parameters!OverDueDat
DateAdd("d",-90,Today()),
IIf( Parameters!OverDueDate.Val
DateAdd("d",-100000,Today(
This worked fine. However it now needs to be a multi select which will not work with the way I have created this filter.
Can you tell me other ways I might be able to create a multi-select range of dates?
Many thanks
Parameter-list.PNG
2FilterTab.PNG
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Tony,
Thanks I am now using 1, 2, 3, 4 instead of the dates. This works but is it possible do a multi-select version of this? My idea now is to find the Min value out of (1,2,3,4) and use that as the start date period and the Max value to use the end date for the 'between' date filter. I am just trying to do this now but I am unsure if this will be accepted as a work around?
Do you think it is possible to get a multi-select date range? E.g. Period '0-30', and '>-90' when a user selects 1 and 4 missing 2,3?
Currently using single selection I use the following in the DataSet Filter.
Start Date
=IIf(Parameters!OverDueDat e.Value=1, DateAdd("d",-30,Today()), IIf( Parameters!OverDueDate.Val ue=2, DateAdd("d",-60,Today()), IIf( Parameters!OverDueDate.Val ue=3, DateAdd("d",-90,Today()), DateAdd("d",-1,"01/01/1900 "))))
End Date
=IIf(Parameters!OverDueDat e.Value=1, Today(), IIf( Parameters!OverDueDate.Val ue=2, DateAdd("d",-30,Today()), IIf( Parameters!OverDueDate.Val ue=3, DateAdd("d",-60,Today()), DateAdd("d",-90,Today()))) )
This works fine for single selection but how would I change this to now use multi-selection?
Many thanks
values-Parameter-Instead-Of-Date.PNG
Thanks I am now using 1, 2, 3, 4 instead of the dates. This works but is it possible do a multi-select version of this? My idea now is to find the Min value out of (1,2,3,4) and use that as the start date period and the Max value to use the end date for the 'between' date filter. I am just trying to do this now but I am unsure if this will be accepted as a work around?
Do you think it is possible to get a multi-select date range? E.g. Period '0-30', and '>-90' when a user selects 1 and 4 missing 2,3?
Currently using single selection I use the following in the DataSet Filter.
Start Date
=IIf(Parameters!OverDueDat
End Date
=IIf(Parameters!OverDueDat
This works fine for single selection but how would I change this to now use multi-selection?
Many thanks
values-Parameter-Instead-Of-Date.PNG
ASKER
Hi Tony,
Sorry I have just clicked about what you said above. So I should create a column in the query? Would I use Case in the select statement? Or do you mean adding the column somewhere else?
Sorry I have just clicked about what you said above. So I should create a column in the query? Would I use Case in the select statement? Or do you mean adding the column somewhere else?
ASKER
Tony just set it up. It was simple in the end like you said. I just created a calculated column and used that in my multi-selection list.
Thanks.
Thanks.
ASKER
This is a good solution. Creating a calculated field instead where you use a switch command and DateDiff and assigning the string to the appropriate ranges.
Hi Papa,
Sorry I haven't got back to you again. For some reason the pre Christmas work rush hasn't abated...
Anyway, I am pleased you are now fully on track.
Thank you for your points, I really appreciate it.
Cheers now.
T
Sorry I haven't got back to you again. For some reason the pre Christmas work rush hasn't abated...
Anyway, I am pleased you are now fully on track.
Thank you for your points, I really appreciate it.
Cheers now.
T
you want a drop down of the 4 values showing the values "4/1/2014 - 3/12/2013", "3/12/2013 - 2/11/2013", "2/11/2013 - 1/10/2013", "older than 1/10/2013"?
you say the user can select a combination of the 4 date ranges.
I'd day this may be hard to do.
Anyway,
I think you can go this way...
For the dataset for the parameter I think you should do this.
Open in new window