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
Prash546
Helper I
Helper I

how to create IN condtion for multiple id's and names

I have few id's, where I want to create a new column named docrot using the below expressio, where Doctor1 and 2 are assigned using id's and others by name using Lookupvalue.

 

IF id in("1234";23456";"565754") then "DOC1" else if id in("4566";4567") then "DOC2" ;lookupvalue("Docname"[table1];"name"[table1];"Docname"[table2])

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Prash546 , Try Like

switch( true(),
id in{"1234","23456","565754"} , "DOC1" ,
id in{"4566","4567"} , "DOC2" ,
lookupvalue("Docname"[table1],"name"[table1],"Docname"[table2])
)

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Prash546 , Try Like

switch( true(),
id in{"1234","23456","565754"} , "DOC1" ,
id in{"4566","4567"} , "DOC2" ,
lookupvalue("Docname"[table1],"name"[table1],"Docname"[table2])
)

Hello Amit, this worked, is there any resoruce where I can learn this functions and also learn Power BI more thoroughly. Thanks.

Helpful resources

Announcements
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.