Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Not applicable

How to find previous and next record from a table?

Hi....

Suppose I have a tbale with dates..

Date
01/01/2011
01/01/2011
01/01/2011
5/05/2011
8/8/2011
8/8/2011
10/10/2011

I want a table with following columns...

DatePrevious DateNext Date
01/01/2011-01/01/2011
01/01/201101/01/201101/01/2011
01/01/201101/01/20115/01/2011
5/05/201101/01/20118/8/2011
8/8/20115/05/20118/8/2011
8/8/20118/8/201110/10/2011
10/10/20118/8/2011-

I want Previous and next record of each rows.

Thanks in advance...

Satish

4 Replies
MVP
MVP

How to find previous and next record from a table?

I think you can use the interrecord functions: above and below:

=above(Date)

resp.

=below(Date)

as expressions for Previous Date and Next Date with dimension Date.

Regards,

Stefan

Not applicable

How to find previous and next record from a table?

I have to use those Previous Date and Next Date fields in Some calculations.

So I need those fields only in script part. I also used Previous and peek functions.

But value I am getting is not right.

Regards,

Satish.

Re: How to find previous and next record from a table?

Hi,


Yes right you need to use the Above and Below fuctions for the date view for the Previous Date and Next Date put Above(Date) , Below(Date).

See the attached sample for clearing your problems.

Regards

Anand

MVP
MVP

How to find previous and next record from a table?

If you want to create that table in script, you might use something like:

Left Join Load *,

peek(Date) as NextDate

resident Dates order by Date desc;

Left Join Load *,

peek(Date) as PreviousDate

resident Dates order by Date ASC;

Where Dates is your calendar table with field Date.

Community Browser