Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Last value

How can I get the last value per dimension in a straight table . so for

LOAD * INLINE [

    Name, Score

    A,10

    B,2

    C,30

    A,15

    B,5

    D,70

];

expecting to get

Name     Score

A                15

B                2

C                30

D                70

Thank you,

Raphael

1 Solution

Accepted Solutions
sunny_talwar

With intervention in the script

LOAD RowNo() as Key,

*;

LOAD * INLINE [

    Name, Score

    A,10

    B,5

    C,30

    A,15

    B,2

    D,70

];

Create a new Key field and use it like this

FirstSortedValue(Score, -Key)

View solution in original post

6 Replies
sunny_talwar

You took the first value for B and Second value for A.... what is the logic here or do you want to show 5 for B?

sunny_talwar

Without intervention in the script, you can try this

Aggr(If(RowNo() = NoOfRows(), Score), Name, Score)

sunny_talwar

With intervention in the script

LOAD RowNo() as Key,

*;

LOAD * INLINE [

    Name, Score

    A,10

    B,5

    C,30

    A,15

    B,2

    D,70

];

Create a new Key field and use it like this

FirstSortedValue(Score, -Key)

Anonymous
Not applicable
Author

Many Thanks Sunny, as always you are saving the day!

isingh30
Specialist
Specialist

Another way of doing this.

LOAD * INLINE [

    Name, Score

    A,10

    B,5

    C,30

    A,15

    B,2

    D,70

]where Score <> 10 and Score <> 5;

Thanks.

shiveshsingh
Master
Master

A:LOAD * INLINE [

    Name, Score

    A,10

    B,2

    C,30

    A,15

    B,5

    D,70

];

inner join

load max(Score) as Score,Name

Resident A

group by Name;