Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
danosoft
Specialist
Specialist

Set Analisys take only the MAX month selected

Hi i have this set analisys to set my variable:

Set vFineMonthContrAlt = MonthEnd(MakeDate(GetFieldSelections(YEAR),Month(Date(Date#(GetFieldSelections(MONTH),'MM')))));

this take me the last day of my year month selected, for example if i select 2018 and 3 it will result: 31/03/2018

i wanna change it in this way:

if i select more months like 3,4,5   i want it result only the last day of the last month i selected, in this example so it must resutl: 30/05/2018

how can i set my variable for this?

thanks

1 Solution

Accepted Solutions
olivierrobin
Specialist III
Specialist III

ok I see the problem

as you declare it in a set instruction, Qlik tries to interpret the $( when you construct your variable

so you have to replace set by let and to disconnect the $ of the (

achieve this by doubling all single quotes

and .....

let vFineMonthContrAlt=

'MonthEnd(MakeDate(GetFieldSelections(ANNOOUT,'';'','''',''Contrattualizzato''),Month(Date(Date#(rangemax(' & '$' & '(=GetFieldSelections(MESEOUT,'','','''',''Contrattualizzato''))),''MM'')))))';

View solution in original post

21 Replies
olivierrobin
Specialist III
Specialist III

hello

maybe by using rangemax()

rangemax(GetFieldSelections(MONTH))

swuehl
MVP
MVP

Maybe replace the GetFieldSelections() [which will only work fine for a single values selected anyway] with Max(FIELD):

Set vFineMonthContrAlt = MonthEnd(MakeDate(Max(YEAR),Max(MONTH)));

danosoft
Specialist
Specialist
Author

not work

i have this: =rangemax(GetFieldSelections(MESEOUT,';','','Contrattualizzato'))

the field is in alternative state "Contrattualizzato"

danosoft
Specialist
Specialist
Author

not work, i need to take the filed from my selection, i have list box where i select the months..

olivierrobin
Specialist III
Specialist III

try rangemax($(=GetFieldSelections(MESEOUT,';','','Contrattualizzato')))

danosoft
Specialist
Specialist
Author

it say "error in expression"

olivierrobin
Specialist III
Specialist III

i've just taken your expression

i have this: =rangemax(GetFieldSelections(MESEOUT,';','','Contrattualizzato'))

and enclosed it in $()

I thought it was correct .

danosoft
Specialist
Specialist
Author

no it not work, look i attach the example so you can try it

i need to find the rangemax from 2 months

and need to find the rangemin from 2 months

thanks

olivierrobin
Specialist III
Specialist III

I tried that with your sample

=rangemax($(=GetFieldSelections(MESEOUT,',','','Contrattualizzato')))

and it works