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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
SamWhite
Frequent Visitor

Custom Column String comparison not working

I have excel file which has a column called Result, it has either values of "Approved" or null. I am writing a if function in custom column which is checking few conditions like:

if [Required]=true then "Yes"

else if [Result]="Approved" then "Completed"

else "Not Completed"

 

However in the Result whereever Result is Approved, it Error in the new custom column. Other If results are fine.

Results is Text coulmn. Please suggest how to make this  if statement work  else if [Result]="Approved"  then "Completed"

6 REPLIES 6
SamWhite
Frequent Visitor

Expression.Error: We cannot convert the value null to type Logical.

Details:

Value=

Type=[Type]

 

This is the error.

As error suggests, your that column is having nulls, and we may be testing it for some value.

 

Compare with my sample data, check, else share a sample data pls.

mahenkj2
Solution Sage
Solution Sage

Hi @SamWhite ,

 

the shared formulae just works well for the condition you state:

 

mahenkj2_0-1713372671168.png

Hope it helps.

dufoq3
Community Champion
Community Champion

Hi, are you sure that you have boolean values true or false in [Required] column? In my opition you have text values "true" or "false" there. If I'm correct, this should help you:

 

if [Required]="true" then "Yes"
else if [Result]="Approved" then "Completed"
else "Not Completed"

 


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

The error is not on the boolean value. The error is for the below line:

else if [Result]="Approved" then "Completed"

 Where-ever Result is equal to Approved is not resulting in Completed. It gives ERROR is the custom coulmn. 

dufoq3
Community Champion
Community Champion

Provide at least screenshot od your data - mentioned columns and screenshot of error please.


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.