Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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"?
Solved! Go to Solution.
@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
@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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.