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

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.

Reply
Anonymous
Not applicable

IF for 2 or more conditionals

Hi,

I'm new on Power Bi and looking to move an excel report to this tool, in this case I'm trying to use an IF formula but getting the following error:

 

Expressions that yield variant data-type cannot be used to define calculated columns.

 

The formula I'm trying to use for a Quality Asurance form:

 

1.Opening= IF([1AppropriateOpening]="YES",1,IF([1AppropriateOpening]="NO",0,"N/A"))

The answers you can get in this (and all other evaluated attributes are)

YES

NO

NA-Example 1

NA-Example 2

NA-Example n

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hey Ross

I think I figured it out, 

 

Opening = SWITCH(
	[1AppropriateOpening],
	"YES", 1,
	"NO", 0,
	BLANK()
)

I think the error was for combining numbers and letters, my guess only, cuz with BLANK it worked

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Switch is the code you are looking for. It allows you to do CASE statements.

 

Opening = SWITCH(
	[1AppropriateOpening],
	"YES", 1,
	"NO", 0,
	"N/A"
)
Anonymous
Not applicable

Hey Ross

I think I figured it out, 

 

Opening = SWITCH(
	[1AppropriateOpening],
	"YES", 1,
	"NO", 0,
	BLANK()
)

I think the error was for combining numbers and letters, my guess only, cuz with BLANK it worked

Anonymous
Not applicable

I still received the message:

 

Expressions that yield variant data-type cannot be used to define calculated columns

 

I'm getting the data from a Drop Down Column directly from SharePoint, do you think this has something to do with it?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.