Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Max of values selected

Hi

I have a field called 'MonthName' with values Jan-Dec.

If multiple values are selected say Jan,Feb,Mar how to find the maximum of the month selected.

I tried giving Max(GetFieldSelections(MonthName)) but i dint ge the Max month selected. It was showing '-'.

Can anyone help me with a correct expression please?

Thanks!

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

=SubField('$(MonthNames)',';',Max(InvoiceMonth))

MonthNames is system Variable

InvoiceMonth you need to replace by your MonthFieldName

View solution in original post

9 Replies
tresesco
MVP
MVP

If you have created this field in the script using Month(), you could simply use max like:

If(GetSelectedCount(MonthName), Max(MonthName))

PrashantSangle

Hi,

just try max(MonthName)

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
MK_QSL
MVP
MVP

Use below

=SubField('$(MonthNames)',';',Max(InvoiceMonth))

svenkita
Creator II
Creator II

does the table have any date field then on selection of the months

do

MonthName(max([Date Filed]))

Anonymous
Not applicable
Author

When i use the above expression its returning 'Jan1990' when Jun is selected.

sushil353
Master II
Master II

It seems your monthname is text value not in the date format..

so you can simply load inline data for Monthname and value and link that with you model and then do max of value or else calculate your monthname from a date function.

Date(datefield,'MMM') as monthName

or

load * inline

[

monthname,value

Jan,1

Feb,2

Mar,3

soon

];

HTH

Sushil

Anonymous
Not applicable
Author

Is 'MonthNames' an variable? And can i Know what is that InvoiceMonth.Is that the Month field used in you expression?

MK_QSL
MVP
MVP

=SubField('$(MonthNames)',';',Max(InvoiceMonth))

MonthNames is system Variable

InvoiceMonth you need to replace by your MonthFieldName

Anonymous
Not applicable
Author

Thanks a lot for the help.