Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Could someone kindly explain how the filter fields present in the following measure expression works in Qlik.
Want to count the Quantity values for a dynamic date period, but I don't understand how finyear, finweek & CalendarMonth actually behave as the measure gives different calculated values when this measure is put in a combo chart visual with CalendarMonth on X axis and This measure on Y axis.
I have finyear, finweek, CalendarMonth and all such fields from Calendar table as filter/slicer in the qlik sheet.
vMax = max(weekstart (cal_date))
vMin = date(max(weekstart(cal_date) - (52*7)))
Year_Count =Count({<date={'>=$(vMin)<=$(vMax)'},[Quantity]={*}-{'0'},finweek=,finyear=,CalendarMonth=>}[Quantity])
You are doing a count of the quantity field where it is not 0. Where the date is between the min and max variables, ignoring any selections on finweek, finyear, calendarMonth.
You calendar is created by your dev so how they are defined you need to speak to them on how they are defined.
Thanks @Mark_Little for your response.
I just want to get a clear understanding of what does "ignoring any selection on finweek, finyear, CalendarMonth" mean actually. If I select any year from finyear slicer the visual bars of the measure show a change of bat length(i.e shows different count values). If the selection of the finyear should be ignored, why is the visual showing a change of measure output values?
Hi @Seadon1210
I guess you need to add the same set analysis expression in vMax e vMin variables as below:
vMax = max( {< finweek,finyear,CalendarMonth >} weekstart (cal_date))
vMin = date(max( {< finweek,finyear,CalendarMonth >} weekstart(cal_date) - (52*7)))
I hope it can help.
Best Regards
I would advise you read up on Set Analysis, how it is structured and how it is applied.
The part of set analysis within {<>} is called the set expression. This returns the set of data that your aggregation on (i.e. your count.)
With Qlik's associate engine your set analysis applied on top of any selections made with in your app. when you add something like finweek= and have a selection 2025 in finyear, you set analysis will still return values for all Finyears
Thanks @Mark_Little
Set expressions is utilised to filter down full model dataset to a specific one needed. How set expression behaves with any slicer field selection was a doubt as it was not clearly available ito me n Qlik documentations I could find. Can you provide the appropriate resource where this is explained clearly?
Thanks @agigliotti for your response.
The variables aren't to be changed, they are suppose to behave as they are defined for. The output given by the Year_count measure is of concern as how the filters in the set expression of the measure would behave with the selection in slicer filters put outside in the sheet(calender fields present in measure are utilised as slicer along with other couple calender fields). The explanation of which I didn't find in any qlik resource, would appreciate if you could provide any.
Take a look here
Also look at the free courses on Qlik learning.
If you want them to stay the full data set you use the 1 qualifier
Like
vMax = max( {< 1 >} weekstart (cal_date))
Once defines the whole set regardless of any selections
Mark
Thank you @Mark_Little for the help.