Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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!
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
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)"}>}
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!
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
Amazing!
Thank you very much for the very helpful solution and references!
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
(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
We are on Qlik SaaS Enterprise.