Forum Discussion

EaglesTony's avatar
EaglesTony
Post Prodigy
1 year ago
Solved

We cannot convert the value null to type Logical error

I have this logic:   = Table.Group(#"Filtered Rows1", {"FeatureKey", "Histories-NonFeatures.AddedorRemovedFromParent"}, {{"Count", each Table.RowCount(_), Int64.Type}})   However, it is throwing ...
  • Ritaf1983's avatar
    1 year ago

    Hi EaglesTony 

    The error doesn't come from your code syntax, but rather from the data itself. The message
    "We cannot convert the value null to type Logical"
    usually indicates that Power Query is trying to evaluate a logical condition on a null value – possibly during internal comparison or grouping logic.

    In your case, it's likely that one of the grouping columns contains null values:

    FeatureKey

    Histories-NonFeatures.AddedorRemovedFromParent

    If either of those has nulls, the grouping may fail because Power Query can't group or compare null values as expected.

    To investigate this, you can do one of the following:

    Enable Column Profiling in Power Query:
    Go to the View tab and turn on "Column profile" and "Column quality". This will help you see if there are any nulls in those columns.

     

    Add a filtering step before the grouping to remove nulls:

    Table.SelectRows(#"Filtered Rows1", each [FeatureKey] <> null and [Histories-NonFeatures.AddedorRemovedFromParent] <> null)
    Then apply your Table.Group step as planned.

    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly