cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Syndicate_Admin
Administrator
Administrator

HELP! Error: Expression.Error: We cannot convert the value null to type Logical.

Hi,

 

I keep getting an error that states, "Expression.Error: We cannot convert the value null to type Logical. Details: Value= Type=[Type] when it runs the code for my custom column. The only commonality I can identify is that one of my columns ([Issue])are all null.

 

My columns are ordered: [Issue Category], [Issue], [Date], [Error Code], [Report Type],l [C_Status], [D_Status]

 

How would I get the custom column to result in "Review Needed" if any of ([Issue Category], [Issue], [Date], [Error Code], [Report Type]) are null/blank AND [C_Status], [D_Status] = "N/A" or "Completed"?

1 REPLY 1
Syndicate_Admin
Administrator
Administrator

@skim56 Use this:

let
    Source = Table,
    Result = 
        Table.AddColumn ( 
            Source,
            "Check",
            (CurrentRow)=>
                let
                    CurrentRowList = Record.ToList ( CurrentRow ),
                    ValuesList = List.FirstN ( CurrentRowList, 5 ),
                    StatusList = List.LastN ( CurrentRowList, 2 ),
                    HasNull = List.NonNullCount ( ValuesList  ) <> List.Count ( ValuesList ),
                    HasNACompleted = List.ContainsAny ( StatusList, { "N/A", "Completed" } ),
                    Result = if HasNull and HasNACompleted then "Review Needed" else "Pass"
                in   
                    Result,
            type text
        )
in
    Result

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (1,559)