Skip to main content
Announcements
YOUR OPINION MATTERS! Please take the Qlik Experience survey you received via email. Survey ends June 14.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to show min and max months /

I am using getfieldselection to show the months selected in the filter list. This shows all the months selected separated by comma.

Is it possible to show only the min and max months instead of showing all the months when multiple months are selected in the filter list?

1 Solution

Accepted Solutions
tamilarasu
Champion
Champion

Hi Sanjyot,

Have a look at the attachment

=If(GetSelectedCount(Month)=1, 'Selected Month: ' & Num(Month),
If(GetSelectedCount(Month)>0,'Min Month: ' & Min(Month) & chr(13) & 'Max Month: ' & Max(Month)))

View solution in original post

9 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

What's wrong with Min() and Max()? You might need to apply these to month-year values rather than month values, of course.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Anonymous
Not applicable
Author

Is it possible to apply min and max to getfieldselection()?

jonathandienst
Partner - Champion III
Partner - Champion III

Why? Just use Min() and Max() on the month-year field. The functions respect the selections, so if you select a number of months, they will automatically adjust to the first and last selected months.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
florentina_doga
Partner - Creator III
Partner - Creator III

use rank

min(data,1) return min data in selection

max(data,1) return max data in selection

Anonymous
Not applicable
Author

Can you share an example using getfieldselections with max?

tamilarasu
Champion
Champion

Hi Sanjyot,

Have a look at the attachment

=If(GetSelectedCount(Month)=1, 'Selected Month: ' & Num(Month),
If(GetSelectedCount(Month)>0,'Min Month: ' & Min(Month) & chr(13) & 'Max Month: ' & Max(Month)))

Anil_Babu_Samineni

This

GetFieldSelect(firstsortedvalue(Month, 'Month Min' & Min(Month),1))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

This is working but doenst show the value in Jan 2013 but in digits like 4233 etc.. how do i convert this to month names?

Anonymous
Not applicable
Author

I put date format and its working..used the below expression

if(GetSelectedCount(Month)=1,Month,if(GetSelectedCount(Month)>1,Min(date(Month,'MMM-YYYY')) & ' to ' & Max(date(Month,'MMM-YYYY'))))