Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Sony
Contributor II
Contributor II

How to assign a date value to a variable based on a formatted date filter pane selection

Hi team, I'm new to QlikSense. I have a date field which has data of only one date per month, in the format - DD-MMM-YY and I created a filter pane by modifying the format of the date field as MonthName(AddMonths(Date Field,-1)). Now, when a value is selected in the filterpane, I want a variable to be assigned to the previous value of the corresponding date field value. 

Date Field                    Filter pane

12-Jan-2022                Dec 21

22-Feb-22                     Jan 22

14-Mar-22                    Feb 22

17-Apr-22                     Mar 22

23-May-22                   Apr 22

05-Jun-22                    May 22

17-Jul-22                     Jun 22

08-Aug-22                   Jul 22

26-Sep-22                   Aug 22

10-Oct-22                    Sep 22

11-Nov-22                  Oct 22

12-Dec-22                   Nov 22

If Feb 22 is selected in the filter pane, then the variable should be assigned to the value - 12-Feb-22. Can anyone please help me? 

Thank you

2 Replies
anat
Master
Master

suppose if we select "Dec 21" in filterpane what value needs to be stored in variable.


Table1:
load*,peek(dt) as previousval;
load * inline [
dt,dt1
12-jan-2022,Dec21
22-feb-2022,Jan22
14-mar-2022,feb22

];

in frontend :use var1=maxstring(previousval)

Channa
Specialist III
Specialist III

you can create variable  as 

vDate=Date Field

but in case if you select multiple value in filter this will not work

make sure you enable single selection in filter

in case you need multiple valuse

create variable as

vDate =Concat(DISTINCTDate Field,',')

Channa