Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
EaglesTony
Post Prodigy
Post Prodigy

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 the "We cannot convert the value null to type Logical" error.

 

Is it one of the 2 fields I am looking that might have a null ?

1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

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.

Ritaf1983_0-1745293854230.png

 

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

4 REPLIES 4
burakkaragoz
Community Champion
Community Champion

Hi,

It looks like you're encountering the "We cannot convert the value null to type Logical" error with the following logic:

 

= Table.Group(#"Filtered Rows1", {"FeatureKey", "Histories-NonFeatures.AddedorRemovedFromParent"}, {{"Count", each Table.RowCount(_), Int64.Type}})

 

This error typically occurs when one of the fields you're grouping by (FeatureKey or Histories-NonFeatures.AddedorRemovedFromParent) contains null values. To resolve this issue, you can add a step to filter out rows where these fields are null before performing the grouping.

Here's an updated version of your logic:

 

let
    // Filter out rows with null values in the grouping fields
    FilteredRows = Table.SelectRows(#"Filtered Rows1", each [FeatureKey] <> null and [Histories-NonFeatures.AddedorRemovedFromParent] <> null),
    // Perform the grouping
    GroupedTable = Table.Group(FilteredRows, {"FeatureKey", "Histories-NonFeatures.AddedorRemovedFromParent"}, {{"Count", each Table.RowCount(_), Int64.Type}})
in
    GroupedTable

 

This should help you avoid the null value conversion error. Let me know if you need further assistance!

Thanks
translation and formatting supported by AI

Ritaf1983
Super User
Super User

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.

Ritaf1983_0-1745293854230.png

 

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

I'll give this a shot and let you know.

 

It sometimes times out getting the data from Odata source, I'm wondering if doing this in DAX would be better.

lbendlin
Super User
Super User

Potentially, but the error may also be elsewhere.  Can you show a sanitized version of your Power Query code and maybe some sample data?

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors