Forum Discussion
In Date Parameter, user Should not be able to select 'To date' lesser/before than 'from date' in Pag
Anonymous You can try these steps:
- In the "Parameter Properties" window, go to the "Default Values" tab.
- For "To Date," you can set the "Default values" based on the "From Date" parameter. This will ensure that the "To Date" is always greater than or equal to the "From Date."
- Select "Specify values."
- Click the "Add" button.
- In the "Value" field, use an expression to set the "To Date" default value to one day after the "From Date." This can be done using an expression like:
=DateAdd(DateInterval.Day, 1, Parameters!FromDate.Value)
- This expression adds one day to the selected "From Date," effectively making the "To Date" at least one day after the "From Date."
If you find this insightful, please provide a Kudo and accept this as a solution.
Hi Devesh_gupta,
Thank you so much for the help but I could not get it to work.
I tried 2 methods :
1. created 2 Parameters as StartDate and EndDate in the Parameters on the top left
2. In StartDate I selected 'no default value' under DefaultValues
3. In End Date I selected 'Speficyvalues' under DefaulValues, selected add and entered the code "=DateAdd(DateInterval.Day, 1, Parameters!StartDate.Value)"
4. Under dataset where I have my dataset as SQL_Data, I have not made any config for date parameters.............. Then I select the 'to date' before the 'from date', the report runs but it brings data from another data from previous year. (Ideally I think the report should not run at all).
Method 2
under dataset-SQL_Data-> under filters->Add->expression-> select the date field
operator-> between. Then under value i selected StartDate. Then in the next box ->fx-> added =DateAdd(DateInterval.Day, 1, Parameters!StartDate.Value)..... The I run the report by selecting 'to date' before the 'from date'. This method does not get any data but report runs succesfully with no data in the report.
Can you please help find what I am doign incorrectly ,
- Anonymous2 years agoNot applicable
devesh_gupta some week ago i resolved it.
Steps to resolve:
under dataset-SQL_Data-> under filters->Add->expression-> select the date field
operator-> between. Then under value I selected [@StartDate]. Then in the next box ->fx-> I selected =Parameters!StartDate.Value. Similarly I selected [@EndDate] and in the fx-> I selected =Parameters!EndDate.Value
This works.
devesh_gupta thank you so much as you made the basic structure.