Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to find second minimum value for each unique field

Hi All,

I am new to qlikview and am having trouble in finding the second min value for each customer. My table is as follows:

CustomerService Date
12014/09/11
22014/09/12
32014/09/12
12014/09/08
32014/09/14
42014/0912
52014/09/20
22014/09/15
22014/09/17
32014/09/20

I am able to get the minimum service date for each customer with the following expression:

=Date(Min([Session Started], [Consumer ID]), 'MM/DD/YYYY')

Now i need to find the second minimum service date for each customer. Please let me know how do we achieve this.

Thanks!!!!

1 Solution

Accepted Solutions
jagan
Partner - Champion III
Partner - Champion III

Script:

TableName;

LOAD Customer,

     Date(Date#([Service Date], 'YYYY/MM/DD')) AS ServiceDate

FROM

[http://community.qlik.com/thread/133850]

(html, codepage is 1252, embedded labels, table is @1);

Straight Table:

Dimension : Customer

Expression: min(ServiceDate, 2)


Hope this helps you.


Regards,

Jagan.

View solution in original post

7 Replies
MarcoWedel

min(field, 2)

Not applicable
Author

Hi Marco,

This does not give the desired output. I want the second minimum of the field 'Service Date' for each customer

MWiciok
Creator
Creator

Hi,

=aggr(min([Service date], 2), customer)

jagan
Partner - Champion III
Partner - Champion III

Hi Ramya,

Try like this

Straight Table:

Dimension : Customer

Expression: min([Service date], 2)

Hope this helps you.

Regards,

jagan.

jagan
Partner - Champion III
Partner - Champion III

Script:

TableName;

LOAD Customer,

     Date(Date#([Service Date], 'YYYY/MM/DD')) AS ServiceDate

FROM

[http://community.qlik.com/thread/133850]

(html, codepage is 1252, embedded labels, table is @1);

Straight Table:

Dimension : Customer

Expression: min(ServiceDate, 2)


Hope this helps you.


Regards,

Jagan.

MK_QSL
MVP
MVP

Check enclosed file...

Not applicable
Author

Thanks for the help guys!!!