Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Read about the latest Qlik Community enhancements on the Community News blog!
cancel
Showing results for 
Search instead for 
Did you mean: 
aatish12345
Creator
Creator

Current and previous selection comparison

Hi All,

I have a date field with always one selected value.

When user will select other date, I want to compare previous date as well as current date in order to set a variable.

Can anyone help me with how to compare current as well as previous selection in Qlik.

 

Regards,

Aatish

 

 

1 Solution

Accepted Solutions
rubenmarin

Hi, If the show condition of the chart is that [Date selected]=[Date stored in variable] it will only show when you press the button.

1. Variable starts blank: chart not calculated

2. User selects a date: chart still not calculated

3. User cliks button: variable populated with selected date, both equals: chart is shown

4. User selects another date. Variable and date selected are different: chart not calculated

5. User clicks button : variable populated with selected date, both equals: chart is shown

...

View solution in original post

7 Replies
rubenmarin

Hi, if you use Only({$1} DateField) you will get the last date selected.

aatish12345
Creator
Creator
Author

Thanks for the reply.

I used the same for comparison, but my actual requirement is :

On every selection of date the table content should get hidden , and in order to view table content, user will click on button (in button I am setting a variable) . Once the contents are visible to user then if user change date then again the contents should get hidden and calculation condition unfulfilled popup should visible.

 

With above comparison of current and previous date, the solution is working partially, but if user select dates more than 2 times then the table contents are still visible because the if condition is still true.

I need a generalized solution on it

Regards,

Aatish

 

rubenmarin

Hi, this is a different request, maybe you can do this adding 2 actions to the button: setting the actual variable and another variable that stores the selected date.

And add to the calculation condition another that checks that DateField='$(variableWithDateSelected)' so if another date is seleted this condion won't be met until the user presses the button again.

Maybe just making the button to store the selected date is enough, so changing the actual variable it sets to store the selected date.

aatish12345
Creator
Creator
Author

Thanks for the reply.

Actually the date field had always one selected value option enabled. So everytime one date will be selected and datefield will have different date set in variable every time user changes the date

rubenmarin

Hi, If the show condition of the chart is that [Date selected]=[Date stored in variable] it will only show when you press the button.

1. Variable starts blank: chart not calculated

2. User selects a date: chart still not calculated

3. User cliks button: variable populated with selected date, both equals: chart is shown

4. User selects another date. Variable and date selected are different: chart not calculated

5. User clicks button : variable populated with selected date, both equals: chart is shown

...

View solution in original post

aatish12345
Creator
Creator
Author

Let me try it out

aatish12345
Creator
Creator
Author

Hi Rubenmarin,

 

I am able to achieve the workaround after trying out the steps you mentioned.

 

Thank you so much for your support

 

Aatish