Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I am having issues with Set Expression using field for Week Year. My expression is:
{<WeekYear = {">=2024/10<=2024/11"}>}
SUM(1)
The field WeekYear is created in my MasterCalendar as WeekName([$(DateField)]) as $(Prefix)WeekYear and the format of the field is YYYY/WW ex. 2024/10;
When I write the Set Expression for searching a range like ">=2024/10<=2024/11" it does not work. Meanwhile, Qlik is correctly searching a range for field MonthYear which is formated as MM.YYYY.
{<[Month Year] = {">=05.2024<=10.2024"}>}
SUM(1)
Ok, just checked the documentation again for the function weekname() and understood why it is not working. The underlying numeric value of the weekname() corresponds to a timestamp of the first millisecond of the first day of the week containing date.
That is why if I use in my set expression: {<WeekYear = {">=2024-01-01<=2024-02-15"}>} it works properly. We need to pass a date in the range search because this is the underlying numeric/date data type of the weekname() function.
Hi, I'm not sure if the dot version is working because it's like a number, Do you have data for other years in that sample?
Anyway, for dates I usually add a field in the calendar table in numeric format, and use that numeric fields in set analysis, in example, for WeekYear I would have a YearWeekNum field, with values like 202405, 202410, 202411... where the numeric comparison for >= or <= always works
Hi,
Thanks for responding!
So Qlik is interpreting both fields WeekYear (YYYY/WW ) and MonthYear (MM.YYYY) as numeric and date but the numeric composition for ">=" does not work for WeekYear in set expression while it works fine for MonthYear. For me it is strange that the field WeekYear which is interpreted as numeric cannot use the range search.
Ok, just checked the documentation again for the function weekname() and understood why it is not working. The underlying numeric value of the weekname() corresponds to a timestamp of the first millisecond of the first day of the week containing date.
That is why if I use in my set expression: {<WeekYear = {">=2024-01-01<=2024-02-15"}>} it works properly. We need to pass a date in the range search because this is the underlying numeric/date data type of the weekname() function.