Gunter Herd
Gunter Herd

Reputation: 125

Power BI: Expression.Error: We cannot convert the value null to type Logical

In the following code, I'm getting an error on line 10 ("Expanded Table Column1"):

let
Source = SharePoint.Files("https://microsoft.sharepoint.com/teams/Fake_Folder/", [ApiVersion = 15]),
#"Added Custom" = Table.AddColumn(Source, "find file", each if Text.Contains([Name], "Fake_Name")
then 1 else 0),
    #"Filtered Rows" = Table.SelectRows(#"Added Custom", each ([Name] <> null)),
    #"Filtered Rows1" = Table.SelectRows(#"Filtered Rows", each ([find file] = 1)),
    #"Filtered Hidden Files1" = Table.SelectRows(#"Filtered Rows1", each [Attributes]?[Hidden]? <> true),
    #"Invoke Custom Function1" = Table.AddColumn(#"Filtered Hidden Files1", "Transform File (6)", each #"Transform File (6)"([Content])),
    #"Removed Other Columns1" = Table.SelectColumns(#"Invoke Custom Function1", {"Transform File (6)"}),
    #"Expanded Table Column1" = Table.ExpandTableColumn(#"Removed Other Columns1", "Transform File (6)",

Basically, I'm selecting a file that matches the name "Fake_Name", and then expanding that file. and I'm getting the error: We cannot convert the value null to type Logical

Prior to the error, the file is being located, it's being filtered, and then when it needs to be expanded as a table, it runs into a null value. How do I fix it when I can't go to the error and the file itself doesn't have the nulls I'm looking for?

Upvotes: 0

Views: 827

Answers (1)

Gunter Herd
Gunter Herd

Reputation: 125

Found the issue: "Sample File 6" (another file referred to in this query) had an issue which caused it to be unloaded, which caused the issue seen here.

Upvotes: 0

Related Questions