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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

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 ACCEPTED SOLUTION
AntrikshSharma
Super User
Super User

@Anonymous 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

AntrikshSharma_0-1669360705822.png

View solution in original post

1 REPLY 1
AntrikshSharma
Super User
Super User

@Anonymous 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

AntrikshSharma_0-1669360705822.png

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors