Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Coming your way, the Qlik Data Revolution Virtual Summit. October 27-29. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator
Creator

Versions of document numbers

Good day,

I've got a list of sales order archives with a number of versions.

How do I write my script to only look at the latest version of each sales order?

Each sales order does not have the same number of versions.

See attached test data.

1 Solution

Accepted Solutions
Contributor III
Contributor III

Hi  Rani

Please try this code

SalesTB: 

LOAD * INLINE [ 

    SOnumber, VersionNumber, Amount, Date

    SO44,1,40,41607

    SO46,1,50,41722

    SO99,1,30,41798

    SO44,4,80,34677

    SO99,3,70,45368

    SO77,1,50,34748

    SO77,6,400,65799

]; 

 

LatestVersion: 

inner keep load 

    SOnumber, 

    max(VersionNumber) as VersionNumber

resident SalesTB 

group by SOnumber; 

drop table LatestVersion;

xpectedOUT.JPG

TheOutput

the output.JPG

cleveranjos‌ , i got this idea from your post, thanks

View solution in original post

2 Replies
Contributor III
Contributor III

Hi  Rani

Please try this code

SalesTB: 

LOAD * INLINE [ 

    SOnumber, VersionNumber, Amount, Date

    SO44,1,40,41607

    SO46,1,50,41722

    SO99,1,30,41798

    SO44,4,80,34677

    SO99,3,70,45368

    SO77,1,50,34748

    SO77,6,400,65799

]; 

 

LatestVersion: 

inner keep load 

    SOnumber, 

    max(VersionNumber) as VersionNumber

resident SalesTB 

group by SOnumber; 

drop table LatestVersion;

xpectedOUT.JPG

TheOutput

the output.JPG

cleveranjos‌ , i got this idea from your post, thanks

View solution in original post

Highlighted
Employee
Employee

Good to read that, keep in touch!