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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
AwasthiAyush
Frequent Visitor

IF column A and B have same text then C otherwise D

Hi All,

I want if its 351J in A and B then give me Work Order and if A & B is just number return Cal WO#.

How to get that?

AwasthiAyush_0-1708711534294.png

 

 

 

1 ACCEPTED SOLUTION
PijushRoy
Super User
Super User

Hi @AwasthiAyush 

 

Column =
IF (
    CONTAINSSTRING ( Table[ColA], "351J" ) && CONTAINSSTRING ( Table[ColB], "351J" ),
    Table[WorkOrderNumber],
    Table[Cal WO#]
)

 

 


Let me know if that works for you


If your requirement is solved, please mark THIS ANSWER as SOLUTION ✔️ and help other users find the solution quickly. Please hit the Thumbs Up 👍 button if this comment helps you.

Thanks
Pijush
Linkedin




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





View solution in original post

3 REPLIES 3
PijushRoy
Super User
Super User

Hi @AwasthiAyush 

 

Column =
IF (
    CONTAINSSTRING ( Table[ColA], "351J" ) && CONTAINSSTRING ( Table[ColB], "351J" ),
    Table[WorkOrderNumber],
    Table[Cal WO#]
)

 

 


Let me know if that works for you


If your requirement is solved, please mark THIS ANSWER as SOLUTION ✔️ and help other users find the solution quickly. Please hit the Thumbs Up 👍 button if this comment helps you.

Thanks
Pijush
Linkedin




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





Hi @PijushRoy 

 

Thank you for replying but I have these columns coming from different tables and we will need a measure instead of Cal Column I guess. Please see the code and how to get the desired result with this .

 

Final WO# =
IF (
    CONTAINSSTRING ('F4801'[Business Unit], "351J" ) && CONTAINSSTRING ( 'F4311'[Cost Center], "351J" ),
    'F4801'[WorkOrderNumber],
    'F4311'[Cal WO#]
)

@AwasthiAyush 

Please create a pbix that contains sample data but still reflects your semantic model (tables, relationships, calculated columns, and measures). Upload the pbix to OneDrive, Google Drive, or dropbox and share the link in this thread. If you are using a spreadsheet to create/import the sample data instead of the manual import method, share the spreadsheet as well. 




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

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