Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
ajsjoshua
Specialist
Specialist

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
sunny_talwar

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
sunny_talwar

Script or front end?

ajsjoshua
Specialist
Specialist
Author

Dear Sunny,

How are you?

i want both in script and front end.

Regards,

Joshua.

sunny_talwar

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

sunny_talwar

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;

ajsjoshua
Specialist
Specialist
Author

Thank you Sunny.