Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Partner
Partner

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
Highlighted
Partner
Partner

Re: Min and Max value of my selection

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 !

8 Replies
Chanty4u
Esteemed Contributor III

Re: Min and Max value of my selection

try this way

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

where vMin = Min(Date)

vMax = Max(Date)

rajeshthakur292
Contributor II

Re: Min and Max value of my selection

Hi,

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

and

Min(Extract_date) for Min?

Thanks,

RT

Partner
Partner

Re: Min and Max value of my selection

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

Partner
Partner

Re: Min and Max value of my selection

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.

rajeshthakur292
Contributor II

Re: Min and Max value of my selection

Hi,

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

Thanks,

RT

Chanty4u
Esteemed Contributor III

Re: Min and Max value of my selection

My expression will work

but you need to select the date range 

then it will show between the selected range dates

Chanty4u
Esteemed Contributor III

Re: Min and Max value of my selection

is this you want?range.PNG

Highlighted
Partner
Partner

Re: Min and Max value of my selection

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 !