The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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
Solved! Go to Solution.
Hi @Gandhi
List.PositionOf returns -1 if the value being searched cannot be found. There is an optional argument in this function if this happens. Please see this documentation: https://learn.microsoft.com/en-us/powerquery-m/list-positionof
Hi @Gandhi
List.PositionOf returns -1 if the value being searched cannot be found. There is an optional argument in this function if this happens. Please see this documentation: https://learn.microsoft.com/en-us/powerquery-m/list-positionof