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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
DanaL
Creator
Creator

Dynamic bookmark in SaaS not working as expected

Hi People,

I'm trying to define a dynamic bookmark, so the last and previous years would be selected:

{<Year={"=Year >= $(=Max({1}Year)-1)"}>}  (2022,2021)

If I select a year (2019), and select the bookmark, the selection is cleared, and the bookmark is not applied.

Only on the second try, when everything is cleared.

Can someone help with this?

Thanks in advance!

 

 

Labels (1)
  • SaaS

1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

If you use the following as search string

=Only({1} Year) >= $(=Max({1}Year)-1)

and then save the selection as a bookmark (create a bookmark) you will get it into a bookmark.

The expression search is described in the help, see 
https://help.qlik.com/en-US/sense/November2021/Subsystems/Hub/Content/Sense_Hub/Selections/Selection...
https://help.qlik.com/en-US/sense/November2021/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/SetAn...

The second link clearly states that the result is based on current selection. This means that the reference to "Year" returns NULL for excluded values, since it respects the current selection. But if you instead use Only({1}Year), it will get a value also for the excluded Years.

See also
https://community.qlik.com/t5/Qlik-Design-Blog/The-Expression-Search/ba-p/1463907

View solution in original post

5 Replies
hic
Former Employee
Former Employee

Yes, the first reference to "Year" within your search string will only match POSSIBLE values. So, instead of 

{<Year={"=Year >= $(=Max({1}Year)-1)"}>} 

you should try

{<Year={"=Only({1} Year) >= $(=Max({1}Year)-1)"}>} 

DanaL
Creator
Creator
Author

Hi @hic 

The thing is that I can't update the bookmark expression.

I have to create first the search string in the Year filter:

=Year >= $(=Max({1}Year)-1)

How do I create the search string with the modification you suggest?

I would also appreciate a reference to an explanation why the addition of the Only function is needed..

Another words: why is the {1} in the Max function is not enough..

Thanks!

hic
Former Employee
Former Employee

If you use the following as search string

=Only({1} Year) >= $(=Max({1}Year)-1)

and then save the selection as a bookmark (create a bookmark) you will get it into a bookmark.

The expression search is described in the help, see 
https://help.qlik.com/en-US/sense/November2021/Subsystems/Hub/Content/Sense_Hub/Selections/Selection...
https://help.qlik.com/en-US/sense/November2021/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/SetAn...

The second link clearly states that the result is based on current selection. This means that the reference to "Year" returns NULL for excluded values, since it respects the current selection. But if you instead use Only({1}Year), it will get a value also for the excluded Years.

See also
https://community.qlik.com/t5/Qlik-Design-Blog/The-Expression-Search/ba-p/1463907

DanaL
Creator
Creator
Author

Amazing!

Thank you very much for the very helpful solution and references!

lwp89
Contributor III
Contributor III

Thanks for the detailed explanation @hic 

 

I have similar issues. I have a date field [Release Date.autoCalendar.Date] and I want a bookmark that will always select yesterday's date on this field.

 

(1) I typed following search string in this date filter

=Only({1} [Release Date.autoCalendar.Date]) =Date({1}today()-1)

 

(2) Then I select the value that the above search string shows

lwp89_1-1660155031458.png

 

(3) Then I created the bookmark.

But the bookmark is showing static value. So the next day it filters the same static date instead of dynamically filtering to the previous day

lwp89_0-1660154946511.png

 

We are on Qlik SaaS Enterprise.