Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
Highlighted
ajsjoshua
Valued Contributor

Peek and Above

Dear all,

My data is 

CountryvasValues
India150
India230
India320
England190
England2100
England310
USA160
USA270
USA380

i want to achieve lik this

 

England150
England230
England320
USA190
USA2100
USA310

Regards,

Joshua.

1 Solution

Accepted Solutions
Highlighted

Re: Peek and Above

For script, you can try this

Table:

LOAD * INLINE [

    Country, vas, Values

    India, 1, 50

    India, 2, 30

    India, 3, 20

    England, 1, 90

    England, 2, 100

    England, 3, 10

    USA, 1, 60

    USA, 2, 70

    USA, 3, 80

];

FinalTable:

LOAD *,

If(vas = Previous(vas), Peek('Values')) as PreviousValues

Resident Table

Order By vas;

DROP Table Table;

View solution in original post

5 Replies
Highlighted

Re: Peek and Above

Script or front end?

Highlighted
ajsjoshua
Valued Contributor

Re: Peek and Above

Dear Sunny,

How are you?

i want both in script and front end.

Regards,

Joshua.

Highlighted

Re: Peek and Above

May be this for Front end

Aggr(Above(Values, 1), vas, Country)

Where hopefully Country is sorted in the script in the correct order.... India, England, USA

Highlighted

Re: Peek and Above

For script, you can try this

Table:

LOAD * INLINE [

    Country, vas, Values

    India, 1, 50

    India, 2, 30

    India, 3, 20

    England, 1, 90

    England, 2, 100

    England, 3, 10

    USA, 1, 60

    USA, 2, 70

    USA, 3, 80

];

FinalTable:

LOAD *,

If(vas = Previous(vas), Peek('Values')) as PreviousValues

Resident Table

Order By vas;

DROP Table Table;

View solution in original post

Highlighted
ajsjoshua
Valued Contributor

Re: Peek and Above

Thank you Sunny.