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!Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hey guys, i created a conditional column of a date field, but when the field is "null" the conditional column returns error. Can you tell the reason?
= Table.AddColumn(#"Colunas Removidas1", "Status",
each if [DTENTREGA] < [DTPREVENT] then "Early"
else if [DTENTREGA] > [DTPREVENT] then "Late"
else if [DTENTREGA] = [DTPREVENT] then "On Time"
else if [DTENTREGA] = null then "In Progress"
else "Dispatch")
Error: Expression.Error: We are unable to convert null value to Logical type. Details: Value= Type=[Type]
Solved! Go to Solution.
Hello - you have to either filter out the nulls first, or use try-otherwise to step over them.
Filter out the nulls first would be like this:
= Table.AddColumn(#"Colunas Removidas1", "Status",
each if [DTENTREGA] = null or [DTPREVENT] = null then null
else if [DTENTREGA] < [DTPREVENT] then "Early"
else if [DTENTREGA] > [DTPREVENT] then "Late"
else if [DTENTREGA] = [DTPREVENT] then "On Time"
else if [DTENTREGA] = null then "In Progress"
else "Dispatch")
Using try-otherwise would be like this, but it is riskier since there could be other errors that are overstepped.
= Table.AddColumn(#"Colunas Removidas1", "Status",
each try
if [DTENTREGA] < [DTPREVENT] then "Early"
else if [DTENTREGA] > [DTPREVENT] then "Late"
else if [DTENTREGA] = [DTPREVENT] then "On Time"
else if [DTENTREGA] = null then "In Progress"
else "Dispatch" otherwise null)
Hello - you have to either filter out the nulls first, or use try-otherwise to step over them.
Filter out the nulls first would be like this:
= Table.AddColumn(#"Colunas Removidas1", "Status",
each if [DTENTREGA] = null or [DTPREVENT] = null then null
else if [DTENTREGA] < [DTPREVENT] then "Early"
else if [DTENTREGA] > [DTPREVENT] then "Late"
else if [DTENTREGA] = [DTPREVENT] then "On Time"
else if [DTENTREGA] = null then "In Progress"
else "Dispatch")
Using try-otherwise would be like this, but it is riskier since there could be other errors that are overstepped.
= Table.AddColumn(#"Colunas Removidas1", "Status",
each try
if [DTENTREGA] < [DTPREVENT] then "Early"
else if [DTENTREGA] > [DTPREVENT] then "Late"
else if [DTENTREGA] = [DTPREVENT] then "On Time"
else if [DTENTREGA] = null then "In Progress"
else "Dispatch" otherwise null)
it worked, thanks for the help!!
You're welcome!
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.