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

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

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. 

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.