The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I'm flummuxed as to why this if statement only returns the first element and errors on the others. any assistance is gratefully recieved. T
if [Column1]>0 then "Other" else
if [Column2]>0 and [Column3] is null then "Closed" else
if [Column2]is null and [Column3]>0 then "Open" else ""
There are no syntax errors but I do get this as an explanation:
Expression.Error: We cannot convert the value null to type Logical.
Details:
Value=
Type=[Type]
My columns have either a number or null value
Solved! Go to Solution.
@Anonymous
First thing, make sure you have numbers in Column 1 ,2 and 3 then apply the new column as follows:
if [Column1] > 0 then "Other" else if ([Column2]> 0 and [Column3] is null) then "Closed" else if ([Column2] is null and [Column3] > 0) then "Open" else null
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
@Anonymous
First thing, make sure you have numbers in Column 1 ,2 and 3 then apply the new column as follows:
if [Column1] > 0 then "Other" else if ([Column2]> 0 and [Column3] is null) then "Closed" else if ([Column2] is null and [Column3] > 0) then "Open" else null
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Thanks Fowmy. The solution was indeed to ensure that all Columns were returning a number. I then changed the formula accordingly. Guess it doesn't like mixing data types.