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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.