Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
swati_rastogi27
Creator
Creator

Retrieving date field from ListBox Selection

Hey experts,

Retrieving date value selected from Listbox is easy , using 

DATE(GetFieldSelections(DATA_DATE))

How to get the previous Max value.

I have last business day of each month in a ListBox starting Jan 31-2020 .

Here are the values : 

31-Jan-2020
28-Feb-2020
31-Mar-2020
30-Apr-2020
29-May-2020
30-Jun-2020
31-Jul-2020
31-Aug-2020
30-Sep-2020
30-Oct-2020
30-Nov-2020
31-Dec-2020
29-Jan-2021
26-Feb-2021

Suppose user selects 30-Jun-2020 , I need Previous Max value 29-May-2020 in a variable.

 

 

Labels (1)
1 Solution

Accepted Solutions
Or
MVP
MVP

First, you don't need that structure to get the selected value - as long as a value has been selected, you can just use =DATA_DATE. If no value has been selected this won't work, but neither will your formula (you can't date() multiple values).

Second, I believe this should get you the last date that's smaller than the selected one, providing a selection has been made:

max({<DATA_DATE= {"<$(=[DATA_DATE])"} >} DATA_DATE)

Note that this assumes your values are already valid dates, as this won't work correctly on text strings.

View solution in original post

2 Replies
Or
MVP
MVP

First, you don't need that structure to get the selected value - as long as a value has been selected, you can just use =DATA_DATE. If no value has been selected this won't work, but neither will your formula (you can't date() multiple values).

Second, I believe this should get you the last date that's smaller than the selected one, providing a selection has been made:

max({<DATA_DATE= {"<$(=[DATA_DATE])"} >} DATA_DATE)

Note that this assumes your values are already valid dates, as this won't work correctly on text strings.

swati_rastogi27
Creator
Creator
Author

Thanks , that worked!