cancel
Showing results 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.

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?

1 ACCEPTED SOLUTION
Super User

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

3 REPLIES 3
Super User

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

Frequent Visitor

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#]
)
Super User

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

Announcements

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

#### Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

#### Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors