Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Load First Row in Script

Hi all,

I want to load the first row for each dimension based on the load order. (This is using script) For example:-

CategoryClass
A2000
A1000
A4000
B5000
B2000
B1000
C1000
C6000
C5000

The result that I want to get is:

A - 2000

B - 5000

C - 1000

I'm trying to use the FirstSortedValue function, but it require a sort weight (which I can't give). Any way to solve this?

Thanks!

1 Solution

Accepted Solutions
sunny_talwar

Try this:

Table:

LOAD Category,

    FirstValue(Class) as Class

FROM

[https://community.qlik.com/thread/170514]

(html, codepage is 1252, embedded labels, table is @1)

Group By Category;


Output:

Capture.PNG

View solution in original post

4 Replies
sunny_talwar

Try this:

Table:

LOAD Category,

    FirstValue(Class) as Class

FROM

[https://community.qlik.com/thread/170514]

(html, codepage is 1252, embedded labels, table is @1)

Group By Category;


Output:

Capture.PNG

Anonymous
Not applicable
Author

See attached

qlikviewwizard
Master II
Master II

Hi khim_hoe,

Please use this script.

FirstValueTbl:

Load * Inline [

Category,Class

A,2000

A,1000

A,4000

B,5000

B,2000

B,1000

C,1000

C,6000

C,5000

];

FirstValue:

LOAD Category,FirstValue(Class) AS ClassNew

Resident FirstValueTbl

Group By Category;

Capture.JPG

Not applicable
Author

Thanks, it works!