Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
richard_chilvers
Valued Contributor

Finding a max (or min) value in a loaded table


I feel there should be an elegant way to find a maximum value for a field in a table which has been loaded in a script. For example, if I am loading sales of products, can I find the last date something was sold? I do not wish to use PEEK in case the loaded data is not in date order.

Any ideas ?

What I am trying to achieve is an incremental load, based on date.

Thanks in advance.

Richard

1 Solution

Accepted Solutions
Partner
Partner

Re: Finding a max (or min) value in a loaded table

Hi,

Main:

Load * from MainData;

Load Max(Date) as MaxDate Resident Main;

Let vMax=peek('MaxDate',-1,'Main');

Thanks,

Jagan

View solution in original post

6 Replies
sujeetsingh
Honored Contributor III

Re: Finding a max (or min) value in a loaded table

Partner
Partner

Re: Finding a max (or min) value in a loaded table

Hi,

Main:

Load * from MainData;

Load Max(Date) as MaxDate Resident Main;

Let vMax=peek('MaxDate',-1,'Main');

Thanks,

Jagan

View solution in original post

richard_chilvers
Valued Contributor

Re: Finding a max (or min) value in a loaded table

Yes - that is elegant. Thank you!

Richard

paul_w_routledg
Contributor II

Re: Finding a max (or min) value in a loaded table

If your Resident data set is large MAX or MIN functions can take a while to resolve.

Here's a useful post on how to optimise this.

Extracting Min(Date) and Max(Date) from large QVD

richard_chilvers
Valued Contributor

Re: Finding a max (or min) value in a loaded table

Thanks guys.

Sorry to have repeated a question from previous posts, but I didn't pick up earlier answers in my search.

Richard

richard_chilvers
Valued Contributor

Re: Finding a max (or min) value in a loaded table

Thanks. Its a good post from Steve and he has helped me several times with my queries