Forum Discussion

Gandhi's avatar
Gandhi
Frequent Visitor
2 years ago
Solved

The index cannot be negative.

I have an problem (data doesn't flow). In Power Query there is 1 error table (or 2, but second one is because first).

Error is:
Expression.Error: The index cannot be negative.
Details:
Value=[List]
Index=-1


and when I go to Error, it is in step "fnGetHighestParent".

= (n as number) as number =>
let
PosOfParent = List.PositionOf( ListTeamID, n ),
ParID = ListParentID{PosOfParent}
in
if ParID = null then ListTeamID{PosOfParent} else @fnGetHighestParent(ListParentID{PosOfParent})

In Data View, there is no negative indexes. So I don't know what this error means. Does anyone has any ideas?

Thank in advance!
-G