Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
danieloberbilli
Specialist II
Specialist II

FirstSortedValue with multiple lowest sort-order

Hi,

I would like to understand the FirstSortedValue() function in the script. If I have multiple lowest sort-orders...how can I still get a value in my output table object? When trying some expressions within the function like MinString(SortOrder)  I get 'nested aggregation-errors' when reloading.

Please find attached an example.

Data:

LOAD * INLINE [

    EmployeeID, Manager, SortOrder, RowID

    1, B, 2, 1

    1, C, 3, 2

    1, A, 1, 3

    1, A, 1, 4

    2, D, 2, 5

    2, A, 1, 6

    3, F, 1, 7

];

Data2:

Load EmployeeID,

firstsortedvalue(Manager, SortOrder) as FirstManager Resident Data

group by EmployeeID;

1 Solution

Accepted Solutions
anbu1984
Master III
Master III

Try adding distinct like below. Ignore the errors appearing and run the script

firstsortedvalue(distinct Manager, SortOrder)

View solution in original post

5 Replies
anbu1984
Master III
Master III

Try adding distinct like below. Ignore the errors appearing and run the script

firstsortedvalue(distinct Manager, SortOrder)

sujeetsingh
Master III
Master III

Anbu has provided a better way to remove the redundancy in your data.

danieloberbilli
Specialist II
Specialist II
Author

Wow, it works - that is weired...so is this actually a bug?

anbu1984
Master III
Master III

Yes

FakeJupiter
Creator
Creator

Is there any way of doing this from in the chart expression view? I'm having exactly the same problem, but it still persists even if I use Distinct.