Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Oleg
Contributor
Contributor

How to make a default selection of max date with "always one selected value"?

I need to make a default selection for the date field so that the maximum date is chosen when I open the app. I have managed to do this:

date={"=[date] = max(total [date])"}

The problem is, I want this field to have the "always one selected value" option enabled, but when I do this, a wrong date gets selected. I have tried "{1}" instead of "total" which didn't help.

Please, tell me, how should I deal with this problem? Thank you.

Labels (3)
5 Replies
bhaskar_sm
Partner - Creator III
Partner - Creator III

Hi,

basically I have worked on your problem statement and able to get the working one by creating an additional column which only has a max date and linked with a Date column. this solution work whenever you have a new date in the data.

Script:

T1:
Load Date#( Date,'DD-MM-YYYY') as DATE, num#(Date) as DATE_NUM;
Load * inline [
Date
28-04-2005
02-06-2005
03-06-2005
04-06-2005
05-07-2016
15-01-2005
12-09-2005
05-09-2004
17-11-2004
29-08-2004
20-06-2004
08-10-2004
21-04-2005
11-12-2005
06-06-2004
23-06-2004
15-07-2004
27-02-2004
14-08-2004
12-03-2004
15-08-2004
04-01-2004
13-08-2004
11-03-2004
];

NoConcatenate
Load Max(DATE) as DATE_N,DATE(Max(DATE),'DD-MM-YYYY') as DATE Resident T1 Order by DATE_NUM desc ;

Front End:

one.JPGtwo.JPG

Oleg
Contributor
Contributor
Author

Thank you, but as far as I understand, this solution won't allow me to choose different dates, so that the max date is always chosen, right? I need to be able to let the user choose any date.

parayu
Contributor II
Contributor II

Hello guys,

I have exactly the same issue and couldn't find any solution. Is this a Qlik Sense limitation maybe?

 

Thanks,

Bogdan

Rick_07011
Contributor II
Contributor II

Have a look at this link Solved: Dynamic Default Bookmark with 'Always one selected... - Qlik Community - 1657592

I used the answer of @eero_h and it worked

muhammadrauf
Contributor II
Contributor II

To make a default selection of the maximum date with "always one selected value," you can use the following steps:

  1. Identify the data source: Determine where your date data is coming from, whether it's a database, a list of values, or some other source.

  2. Retrieve the maximum date: Write a query or code to retrieve the maximum date from your data source. This can often be done using SQL queries or programming languages like Python, depending on your data source.

  3. Set the default selection: Once you have the maximum date, set it as the default selection in your user interface or application. This can typically be done using the appropriate programming or UI framework you are working with.

  4. Enable "always one selected value": Ensure that your user interface or application is configured to enforce the rule of "always one selected value" for the date field. This means that users cannot deselect the maximum date or select another date, depending on your specific requirements. Click here

The exact implementation details may vary depending on your technology stack and application framework, but these general steps should help you achieve the desired outcome of having the maximum date selected by default with the "always one selected value" constraint.