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

min/max within a date in load script

Hello,

I have data like this:

date      value

1/1/11     5

1/1/11     6

1/1/11     9

1/1/11     2

2/1/11     4

2/1/11     5

2/4/12     12    

2/4/12     12

2/4/12     1

2/5/12     1

2/5/12     2

i need to make a table that for every date has the max value.

i want to do this in my load script.

thanks so much!!!

3 Replies
Not applicable
Author

load

date,

max(value) as maxvalue

from table

group by date;

Anonymous
Not applicable
Author

I guess that you want to find the max value, which is 12, and get the date where the value is 12.

tmp:
Load max(value) as MaxValue From yourtable;
LET vMaxValue=peek(MaxValue);
Drop table tmp;

Load date From yourtable
Where value = $(vMaxValue);

Regards,
Michael

Not applicable
Author

try this

AB:

LOAD * INLINE [

    date,      value

    1/1/11,     5

    1/1/11,     6

    1/1/11,     9

    1/1/11,     2

    2/1/11,     4

    2/1/11,     5

    2/4/12,     12

    2/4/12,     12

    2/4/12,     1

    2/5/12,     1

];

LOAD date,max(value) as maxvalue

Resident AB

Group by date;

*********************************************************************

if you want the max value in value field for all date then try this.

load max(value) as max Resident AB;