Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear all, could you help me to get the max value of my selection
Eg. Now my selection of period is 201011, 201012, 201101
I wanna to get the max and min of it: max should be 201101, min should be 201011
I tried RangeMax
it works when I try RangeMax(2011,2012,2013), the result is '2013'
but when I tries RangeMax(GetFieldSelections(period)), the result is '-'
I wonder why the expression failed
Help!
Thanks so much!
when you select more values of select box and remaining values not selected are very less then getfieldselections() will return the text NOT followed by not selected values:
for example I have field called year ranges from 2005- 2014
If I select less values say 2005-2008, GetFieldSelections(Year) will return all the years with , delimited.
when I select 2005-2012, GetFieldSelections(Year) will return Not 2013,2014
So I used not in that solution.
Please find the attachements
Niranjan M.
Hi,
use this expression for getting max of current sections.
=if(Left(GetFieldSelections(Year),3) = 'NOT',
max({<Year-={$(=SubField(GetFieldSelections(Year),'NOT ',2))}>} Year),
max(Year))
note:
if you have large year values then you need to use the GetFieldSelections(Year,maxvalues) fuction
where maxvalues is the number more than the half of the field values count.
hope it helps you.
Niranjan M.
hi
for get max and min value on selection, try it
sum({<year = {"$(=max(year))"}>}sales)
Hi
Not sure if I have understood your question properly, but just use Max(period) and Min(period). These respect your selections so they will contain the latest and earliest period from your selection.
If you want to use it in an expression, the previous post is almost right:
Sum({period = {"$(=Max(period))"} sales)
Regards
Jonathan
I love your answer. it do works
but could you explain it?
what does 'NOT' mean?
why I need to justify it?
Hi,
Please see the link I explained it:
http://community.qlik.com/message/303451#303451
Thanks,
Niranjan M.
it shows
when I clicked the link.
when you select more values of select box and remaining values not selected are very less then getfieldselections() will return the text NOT followed by not selected values:
for example I have field called year ranges from 2005- 2014
If I select less values say 2005-2008, GetFieldSelections(Year) will return all the years with , delimited.
when I select 2005-2012, GetFieldSelections(Year) will return Not 2013,2014
So I used not in that solution.
Please find the attachements
Niranjan M.
Thanks so much for your explanation