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: 
buddhabang
Contributor III
Contributor III

FirstSortedValue or Similar?

Morning everyone,

Can someone please help me regrading FirstsortedValue or something similar.

I'm currently trying to get the latest meter readings using FirstSortedValue as follows, based on a key i've created which is made up of  Date&''&Time

FirstSortedValue(Meter_Read, -Key, 1)

FirstSortedValue(Meter_Read, -Key, 2)

FirstSortedValue(Meter_Read, -Key, 3)

to get the subsequent read.

My problem is when the two keys are the same, qlikview does not bring any data.

Any way to solve this issue please?

Best Regards.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

You can use DISTINCT qualifier to get a result, the first in load order AFAIR.

FirstSortedValue(DISTINCT Meter_Read, -Key, 1)

Or try creating your own sort order for equal keys by adding some small values depending in other fields.

View solution in original post

2 Replies
swuehl
MVP
MVP

You can use DISTINCT qualifier to get a result, the first in load order AFAIR.

FirstSortedValue(DISTINCT Meter_Read, -Key, 1)

Or try creating your own sort order for equal keys by adding some small values depending in other fields.

buddhabang
Contributor III
Contributor III
Author

Thanks Swuehl, i used distinct and it worked like a peach. Thanks a lot