Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I Have a filter setup for Year Month. As time passes, new data is created.
The app is set to "Always one selected value" and according to documentation and this youtube video from Qlik Help (Setting a default selected value) the default value should be the one that comes first in the list.
Except that the default value doesn't seem to update as the app does. It uses the value that you had when you published it. Is this as intended or is this a bug? If this is as intended, then how do I go about making the default month always be the current month?
That's probably intended. I believe you can solve your issue with a default dynamic bookmark. See this qlik help video: https://help.qlik.com/en-US/video/tFyqOigqnUw
This is the expected behavior if you want the current Month/Year to always be displayed in the filter and the others not to be visible.
So create the dimension from the expression below, returning only the current field of your data:
=aggr(
if([Year Month]=max(total [Year Month],1),[Year Month]),[Year Month])
- Regards, Matheus
Thanks for the suggestion. That video was interesting and looks really close to giving me an answer.
I tried putting a formula in my filter and I did get results... but the wrong results. My field is YearMonth_ZZZ, because I use ZZZ as a hide suffix. The field YearMonth_ZZZ is created in my script as a dual function using
DUAL(YearMonth,Monthstart(%Date)) as YearMonth_ZZZ
and YearMonth is defined previously as YEAR&' - '&MONTH
YearMonth_ZZZ=Monthstart(Now()) As per the video I'm explicitly writing out the field name in the filter, no results.
=Monthstart(Now()) Dropping out the field name. I do get results this way, but inexplicably they're wrong.
Because it's a Dual function I should be able to search using the text or the number / date and the fact I'm getting results certainly seems to support this. But the result is just simply to go back to the date it was published which is wrong.
I even checked that Now() Today() and ReloadTime() were all working as expected and they are. See screenshot below.
I don't want it to be part of set analysis. The field is set to "always one selected" so it should always have a value. I just want the default selected month to increment to always show the current month.
Thanks for your suggestion though.
Add an equal sign before your search statement, like this:
=YearMonth_ZZZ=Monthstart(Now())
Do you have a specific reason why you are using dual()? I'm thinking it might be better to keep the value as a date, and then format it as needed in frontend, e.g. date(YearMonth_ZZZ, 'YYYY-MM')
Hi, Yes I was using Dual so that it could be sorted. I think my code just evolved like that for reasons, but I agree using date and specifying the format would be neater, so I've changed that.
Date(Monthstart(DATE),'YYYY - MM') as YearMonth
I tried adding a leading equals sign and still didn't get any results. I expect it's because I'm also using always one selected value? But it's specifically in these instances where we're most likely to want to control what our default "one selected value" is, right?
I tried testing some other ideas. If I take out the YearMonth_ZZZ from the start, then I get this which is bizarre. That's still showing the published date.
If I ask for Max(YearMonth_ZZZ) then I get the same which is no surprise because that is what is currently selected. But If I ask for Max({1}YearMonth_ZZZ) then I get everything as a list, which it still can't process because it needs 1 selected value. However, this led me down a path of thinking about AGGR.
But no combination that I've tried yet has returned the max date. I've got multiple ways of getting no results and multiple ways of getting the published date.
Ok, so maybe like
"=YearMonth_ZZZ=monthstart( max(total DATE)) "