Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Firstsortedvalue with load order

Hello,

Is it possible to use a field in the firstsortedvalue function with a weight of it's load order?

Thank you in advance.

3 Replies
sunny_talwar

If you have created a field like RowNo() as Key, you should be able to use Key as a load order. Is this what you were looking for, or did I mis-understand?

sunny_talwar

Another option is to use the Aggr() functions load order capability here. (This wouldn't require any modification in the script)

Script

Table:

LOAD * Inline [

Country, Value

India, 10

India, 15

India, 12

India, 16

USA, 12

USA, 30

USA, 4

USA, 49

USA, 2

China, 23

China, 40

];

Greens are the last value by load order and Red are the first value by load order

Straight table

Dimension

Country

Expression

1) =FirstSortedValue(Value, -Aggr(RowNo(TOTAL), Value, Country)) -> Green Values

2) =FirstSortedValue(Value, Aggr(RowNo(TOTAL), Value, Country)) -> Red Values

Capture.PNG

pover
Luminary Alumni
Luminary Alumni

One caveat with this approach is that if the Value field in the above example has duplicates, the load order is determined by the global load order and not the load order sliced by each country. So this will really only work when the Value field values are unique.