Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hey guys,
Consider the below sample data:
| source | A | B | MK |
| x | AZ~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!
Solved! Go to Solution.
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)
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)
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!