Forum Discussion
Anonymous
3 years agoNot 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 comm...
- 3 years ago
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
3 years agoCommunity Champion
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