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
Anonymous
Not applicable

M-Query Text Function

Hi Team,

 

I haven't get result in the below funcion from M-Query.

 

 

= Table.AddColumn(Rule1, "Rule2", each if(Text.Start([#"Temp (NTM)"] ,3) <> "DCL" or Text.Start([#"Temp (NTM)"],3) <> "DSA" or Text.Start([#"Temp (NTM)"] ,3) <> "DBC" ))
then "Placed"
else null)

 

Data look liks this,

 

screen.PNG

 

KV's

1 ACCEPTED SOLUTION
V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

Try this:

= Table.AddColumn(#"Changed Type", "Custom", each if Text.StartsWith([#"Temp(NTM)"], "DCL") then "" else if Text.StartsWith([#"Temp(NTM)"], "DSA") then "" else if Text.StartsWith([#"Temp(NTM)"], "DBC") then "" else "PLACED")

test_M-Query Text Function.PNG

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

Try this:

= Table.AddColumn(#"Changed Type", "Custom", each if Text.StartsWith([#"Temp(NTM)"], "DCL") then "" else if Text.StartsWith([#"Temp(NTM)"], "DSA") then "" else if Text.StartsWith([#"Temp(NTM)"], "DBC") then "" else "PLACED")

test_M-Query Text Function.PNG

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , what should happen, then is missing

Table.AddColumn(Rule1, "Rule2", each if(Text.Start([#"Temp (NTM)"] ,3) <> "DCL" or Text.Start([#"Temp (NTM)"],3) <> "DSA" or Text.Start([#"Temp (NTM)"] ,3) <> "DBC" then <> else <> ))

 

else is optional

Anonymous
Not applicable

Hi @amitchandak ,

 

i have replaced my post.

 

Thanks,

KV's

@Anonymous , seem fine. Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Anonymous
Not applicable

Hi @amitchandak ,

 

i can't paste my raw data so i shared my post in screenshot.

 

screen.PNG

 

please help me.

 

Thanks,

KV's

@Anonymous , I they should be and

Table.AddColumn(Rule1, "Rule2", each if(Text.Start([#"Temp (NTM)"] ,3) <> "DCL" and Text.Start([#"Temp (NTM)"],3) <> "DSA" and  Text.Start([#"Temp (NTM)"] ,3) <> "DBC" ))
then "Placed"
else null)

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.