Forum Discussion

hohlick's avatar
hohlick
Continued Contributor
9 years ago
Solved

Removing errors from list (not column) - in Power Query 'M'

Hi All, cannot resolve some issues with lists containing errors in Power Query (Query Editor). Suppose I have a list named ListWithError:   ListWithError = {"01-01-2016", 1, Date.From("this is no...
  • OwenAuger's avatar
    OwenAuger
    9 years ago

    hohlick IvanBond

     

    Here are two further ideas using List.Positions to index the original list, but I don't think they are necessarily any more elegant and not sure performance-wise:

    =
    List.RemoveNulls(
        List.Transform(
            List.Positions( ListWithError ),
            each try ListWithError{_} otherwise null
        )
    )
    =
    List.Accumulate(
        List.Positions( ListWithError ),
        {},
        (CleanListSoFar, CurrentPosition) =>
            CleanListSoFar &
    (if
    (try ListWithError{CurrentPosition})[HasError] then {} else {ListWithError{CurrentPosition}} ) )