Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
reivax31
Partner - Creator III
Partner - Creator III

Min and Max value of my selection

Hi Qlikers,

I would like to find the max/min date of my selection for this I used:

(GetFieldSelections(Extract_Date,',',100))

The result is:

29/05/2018,30/05/2018,31/05/2018,01/06/2018,04/06/2018,16/05/2018,17/05/2018,18/05/2018,22/05/2018,23/05/2018,24/05/2018,25/05/2018,28/05/2018

The dates in Bold are the one in green selection.

green.png

the other date are in dark grey but selected (check mark next to the value)

grey.png

The value I want to find is 04/06/2018 for max and for min 16/05/2018. How can I do?

Best regards

1 Solution

Accepted Solutions
reivax31
Partner - Creator III
Partner - Creator III
Author

Hi,

I found a way by using this for Max:

=if(date(right(GetFieldSelections(Extract_Date,',',200),10))>

date(SubField(GetFieldSelections(Extract_Date,',',200),',',GetSelectedCount(Extract_Date))),

date(right(GetFieldSelections(Extract_Date,',',200),10)),

date(SubField(GetFieldSelections(Extract_Date,',',200),',',GetSelectedCount(Extract_Date))))

and for Min:

=if(IsNull(date(SubField(GetFieldSelections(Extract_Date,',',200),',',GetSelectedCount(Extract_Date)+1))),

date(left(GetFieldSelections(Extract_Date,',',200),10)),

if(date(left(GetFieldSelections(Extract_Date,',',200),10))<

date(SubField(GetFieldSelections(Extract_Date,',',200),',',GetSelectedCount(Extract_Date)+1)),

date(left(GetFieldSelections(Extract_Date,',',200),10)),

date(SubField(GetFieldSelections(Extract_Date,',',200),',',GetSelectedCount(Extract_Date)+1))))

this way I managed to find in my list of date the one I need

29/05/2018,30/05/2018,31/05/2018,01/06/2018,04/06/2018 (max),16/05/2018 (min),17/05/2018,18/05/2018


I know it's very clean but it works !

View solution in original post

8 Replies
Chanty4u
MVP
MVP

try this way

=sum({<Date = {'>=$(=vMin)<=$(=vMax)'}>}Sales)

where vMin = Min(Date)

vMax = Max(Date)

Neymar_Jr
Creator II
Creator II

Hi,

Why don't you use Max(Extract_date) for Max

and

Min(Extract_date) for Min?

Thanks,

RT

reivax31
Partner - Creator III
Partner - Creator III
Author

because I really need the min and max dates of my selected dates, not the on in my selection.

For exemple:

the min for my selected dates is :  16/05/2018

the min for my selection is : 29/05/2018 (Min(Extract_date))

What I need is the min of my selected date: 16/05/2018 (see check mark in my screenshot)

BR

reivax31
Partner - Creator III
Partner - Creator III
Author

vMin = Min(Date) . but this is what I want to find, the vMin. But Min(Date) will not return value 16/05/2018 as it is out of my selection.

Neymar_Jr
Creator II
Creator II

Hi,

Min(Extract_date) will return min of the selected date. Isn't it something that you want?

Thanks,

RT

Chanty4u
MVP
MVP

My expression will work

but you need to select the date range 

then it will show between the selected range dates

Chanty4u
MVP
MVP

is this you want?range.PNG

reivax31
Partner - Creator III
Partner - Creator III
Author

Hi,

I found a way by using this for Max:

=if(date(right(GetFieldSelections(Extract_Date,',',200),10))>

date(SubField(GetFieldSelections(Extract_Date,',',200),',',GetSelectedCount(Extract_Date))),

date(right(GetFieldSelections(Extract_Date,',',200),10)),

date(SubField(GetFieldSelections(Extract_Date,',',200),',',GetSelectedCount(Extract_Date))))

and for Min:

=if(IsNull(date(SubField(GetFieldSelections(Extract_Date,',',200),',',GetSelectedCount(Extract_Date)+1))),

date(left(GetFieldSelections(Extract_Date,',',200),10)),

if(date(left(GetFieldSelections(Extract_Date,',',200),10))<

date(SubField(GetFieldSelections(Extract_Date,',',200),',',GetSelectedCount(Extract_Date)+1)),

date(left(GetFieldSelections(Extract_Date,',',200),10)),

date(SubField(GetFieldSelections(Extract_Date,',',200),',',GetSelectedCount(Extract_Date)+1))))

this way I managed to find in my list of date the one I need

29/05/2018,30/05/2018,31/05/2018,01/06/2018,04/06/2018 (max),16/05/2018 (min),17/05/2018,18/05/2018


I know it's very clean but it works !