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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
samerhaidar0811
Frequent Visitor

IF source = 'x' then ELSEIF source = 'y' then

Hey guys,

Consider the below sample data:

source ABMK
xAZ~ER_MK~PK_PR~PAXF_CN~SC   PK
y YQ~21Q3_CA~eComNoneCom_MK~TR_CP~987  TR

 

I need to write an if else conditon which does the following:
if source = x then i need to extract the letters between _MK~  and the following _ from column A

else if source = y then i need to extract the letters between _MK~  and the following _ from column B

 

The result should be the custom column (MK) as shown in the table above.

 

Apprecitate your support!

1 ACCEPTED SOLUTION
AntonioM
Solution Sage
Solution Sage

Hi @samerhaidar0811 

 

You could use this step in Power Query to create the column

= Table.AddColumn(#"Changed Type", "MK", each if [#"source "] = "x" then Text.BetweenDelimiters([A], "_MK~", "_") else if [#"source "] = "y" then Text.BetweenDelimiters([B], "_MK~", "_") else null)

 

AntonioM_0-1662471518688.png

 

View solution in original post

2 REPLIES 2
AntonioM
Solution Sage
Solution Sage

Hi @samerhaidar0811 

 

You could use this step in Power Query to create the column

= Table.AddColumn(#"Changed Type", "MK", each if [#"source "] = "x" then Text.BetweenDelimiters([A], "_MK~", "_") else if [#"source "] = "y" then Text.BetweenDelimiters([B], "_MK~", "_") else null)

 

AntonioM_0-1662471518688.png

 

Thanks @AntonioM !

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.