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
devika
Helper II
Helper II

If and multiple conditions

I'm creating a column with 'And' ,'Multiple Conditions'

 

Co = IF(and[RRR]=1, ([Highest]="Rer" or [Highest]="Con" or [Highest]="EC") then 1 else 0)
 
I worked out for single conditon but trying to tackle multiple conditions. any help would be great, thanks

Co = IF(AND([RRR]=1, [Highest]="Rer"),1,0)

1 ACCEPTED SOLUTION
littlemojopuppy
Community Champion
Community Champion

Hi.  Try this...

 

IF(
	AND(
		[RRR] = 1,
		[Highest] IN {"Rer", "Con", "EC"}
	),
	1,
	0
)

 

 

 

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@devika , if you are trying on power Query/M

Co = if [RRR]=1 and ([Highest]="Rer" or [Highest]="Con" or [Highest]="EC") then 1 else 0

or

Co = if [RRR]=1 and [Highest] in {"Rer" , "Con" ,"EC" }  then 1 else 0

 

In DAX a new column

Co = IF([RRR]=1 && [Highest] in {"Rer" , "Con" ,"EC" } , 1 , 0)

 

devika
Helper II
Helper II

I managed to solve by Switch(true(), [rrr]=1 && [Highest] ="Rer",1,[rrr]=1 && [Highest] ="Con",1,0)

 

I will yours solution too and post it here. thanks for you reply

littlemojopuppy
Community Champion
Community Champion

Hi.  Try this...

 

IF(
	AND(
		[RRR] = 1,
		[Highest] IN {"Rer", "Con", "EC"}
	),
	1,
	0
)

 

 

 

Something around IN Operator is not right.

 

Getting Token Comma Expected error... not sure what is missed

Can you paste your code?  I tried it in another project and worked perfectly

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.