Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

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,

 

 

KV's

  • 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")

     

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

6 Replies

Replies have been turned off for this discussion
  • 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's avatar
      Anonymous
      Not applicable

      Hi amitchandak ,

       

      i have replaced my post.

       

      Thanks,

      KV's

      • amitchandak's avatar
        amitchandak
        Super User

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

  • V-lianl-msft's avatar
    V-lianl-msft
    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")

     

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