I have a crystal report where i have a date parameter called range that i want to default the min and maxdate values. So in the edit parameter dialog under value options section there are options for "start" and "end" which i want to be mindate and maxdate respectively. The problem i am trying to solve is i want all records to return if the user does not enter a value for the range. Is this even possible? Thanks in advance for any advice.
I am running latest version of crystal reports
Easy way I think is of using 2 parameters instead of one, That is one parameter for start date and other for End Date.
Add a default value None for both and if user doesn't want to select any value then ask to select None
Now change your record selection formula as
if {?start date} = "None" and {?End date} = "None"
then
//Don't pass any date filter
else
//Add date filter as per parameter selection
An easy way could be to just enter min and max dates manually and make the parameter not optional.
A more elegant way is to check whether the parameter has a value and only filter your records if it has. Put something like the below in your record selection formula:
if hasvalue({?range}) then {yourdatefield} in {?range} else true
If the parameter range has a value then it is used as filter. If it hasn't a value the term will evaluate to true meaning no records will be filtered.
Yes it is possible make the parameter as optional. By default it will bring all the data, if user not select any thing.
Related
Nonreadable(Readonly-Can not change the date value) date parameter is possible in SSRS Report?
Thank you in advance.
Make a dataset that returns your desired date. Set the parameter's query dataset to take values from that dataset - i.e. there is only one date that can be selected. Make the parameter's default value be the value from that dataset. Uncheck "Allow null value".
The parameter now shows the desired date and can't be changed.
I have a data type "v_content" with fields "from" and "untill", both are of type DATE(ISO).
Now I need to configure a view, which will show only those v_contents in date range:
show only if from <= NOW <= untill
Sadly, in Filter criteria in view configuration, I can select the field, but cannot compare the value with current date, there are some predefined other non related settings.
Also in Contextual filters, there is no comparsion settings.
So, how do I filter nodes in view by comparsion of its field values against current date?
Thanks in advance.
When you configure condition for date field you you have select showing default value "select a date" which you can change to "Enter a relative date" and then in input field bellow enter "now".
I am trying to set up a filter or parameter for different date ranges in Tableau, such as:
Previous Week
Previous 4-Weeks
Previous 8-Weeks
based on the most recent data in the database. Is this possible?
Edit:
I should have been more clear here.
Is it possible to only have these options in the filter and have it based on the maximum date in the database?
Update
Based on your comment and updated question, you can do it as you intend, though it isn't as straight-forward.
NOTE: I did this very quickly and with a random data set, so it will be important for you to test this thoroughly with your data set.
Steps:
Create a parameter control that the users will use to change the selected date range. I created this as a list of strings with values that I can use directly in a calculated (after simple casting):
Create a calculated field that you will use as a filter that references the selection of the parameter control. It tests to see if the difference (in weeks) between the maximum date in the view and the date of any given row is less than the value of the parameter.
Calculation: INT([Date Filter Parameter]) > DATEDIFF("week",ATTR([Date Field]),WINDOW_MAX(MAX([Date Field])))
Place the calculated field in the filter box and set it to True.
You will be able to filter your data like so:
Original Answer
Yup - that is built into Tableau.
Add your date to the filter and select the "Relative Date" option:
You can set the defaults - users can change these later:
Then just "Show Filter":
I am looking to setup a report subscription in SSRS 2008 R2 where the client user can set the date parameter to whatever the individual user would like. I have been reading multiple suggestions to use =Today() in the parameters but this syntax does not work for me. Does anyone know whether is is possible to set my from date to "Today -30 days" and my to date to "today"? What is the syntax used in the subscription parameters?
Settings:
Error:
As described in the above link provided by praveen the solution became to create two parameters in the report containing integer values with a label that describes the periods i would like to use in my subscription. These parameters can easily be set to "Hidden" so they are not showing when you would like to run the report by hand. I also chose to set the default value for both parameters to 1 which is my value for Today(). This mean my report will start out with having today's date selected in both of the visible date parameters.
In the two date parameters that are shown in the report you can then set the default value to a switch of the values you are able to pick in your hidden date parameters. You can now setup a subscription that will work and that looks like the following:
I'm new to Crystal and I have to create a basic report that requires 2 input optional parameters: DateStart and DateEnd.
Report shall include amount of records in a table beetween 2 dates (if DateEnd date value is missed report shall consider that it requires all records no matter how old they are. If DateStart is missed report shall consider it requires all records no matter how young they are)
I guess I'll have to use SQL Expression Field but can't figure out how to implement where clause.
How would you implement such a report?
Thank you in advance!
Try this:
Create a Date Parameter with optional prompt and range.
Then i Record Selection Formula put:
if ( (not HasValue({?PARAM_YOUR_DATE}) or (not(HasLowerBound({?PARAM_YOUR_DATE}))) or (not(HasUpperBound({?PARAM_YOUR_DATE}))) ) then
True
else
{YOURDB.YOUR_DATE_FIELD} in {?PARAM_YOUR_DATE};
When you want to show all records add special value i.e. 01/01/1900
crParameterDiscreteValue.Value ="19000101";
In First Formula
{?DateStart} = '19000101' or {table.DateStart} = {?DateStart}
In Second Formula
{?DateEnd} = '19000101' or {table.DateEnd} = {?DateEnd}
no need to use if else statement.