Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a Requirement to create a report
- which will have defaulted to max year on opening the document
( Achieved it using triggers on open)
- A report which compares current year to previous year comparision of counts
( Achieved it using set analysis for Current year as - =Sum({Year={$(=GetFieldSelections(Year))}>} issuecount)
and year ago counts using =Sum({Year={$(=GetFieldSelections(Year)-1)}>} issuecount)
)
But when we clear the selections the chart dispalys nothing.
my requirement here is to default the graph to max year when all the selections are cleared.
Please can you help
Thanks
KS
Sum({Year={$(=max(Year))}>} issuecount)
Sum({Year={$(=max(Year)-1)}>} issuecount)
Try like:
Sum({<Year={$(=Max(Year))}>} issuecount)
and
Sum({<Year={$(=Max(Year)-1)}>} issuecount)
Sum({Year={$(=max(Year))}>} issuecount)
Sum({Year={$(=max(Year)-1)}>} issuecount)
try with
sum({$<Year={$(=max(Year))}>} issuecount)
Thanks Tresesco for quik help.
I tried it and it worked. I would like to understand its behaviour though.
so when we open the dashboard it takes max year displayes results.
when we select any other year in the list box, is that replacing the max year by the field value selected?
does that mean that qlikview is not checking the expression as is ? if it checks as is, it has to always give the max year as the year available in my entire dataset but it doesnt do that.
please help me with this understanding
Thanks
KS
When no selections are made then all possible values for Year are in the "Year Array".
Selecting a Year/Years will reduce the "Year Array" to those selected values. Selecting another field could also reduce the array because of the associative model.
The Max(Year) function will return the biggest numeric value in the "Year Array".
If you want the function to give you the biggest numeric value in the "Year" field regardless of selections then the expressions becomes:
Max({1} Year). The {1} tells QlikView to disregard user selections.
in expression:
Sum({<Year={$(=Max({1} Year))}> issuecount)
Hi Swapnil,
When ever you select a year QV consider that Year and fetch data corresponding to that year and Year-1.
If you take year as dimension then you can see it will display data for only Max Year and max Year-1 and other years will have 0 corresponding to that.
Regards
KC
Max(Year) - returns the max of year out of the years that are in the scope. Now 'in the scope' means -
- all the years when no year is selected
- a particular one or multiple years which are selected
So it is actually checking the expression. You have to just understand the 'in the scope' concept. Hope this helps.
Excellent. Thanks for the detailed explanation Simen
Regards
KS