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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

Extract Text Before Delimiter for multiple columns in a single query step

Hi there,

 

I have multiple columns in my data set that all require a query step that involves extracting text before delimiter (Text.BeforeDelimiter).

Is it possible to invoke this for all the required columns using just a single query step, or would I have to do the step for each column individually?

 

Thanks. 

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

Select all of the columns you want to transform before applying Transform > Extract > Text.BeforeDelimiter and it should apply the step to all of the selected columns in a single step with M code that looks like this:

= Table.TransformColumns(Source,
      {
          {"Column1", each Text.BeforeDelimiter(_, "|"), type text},
          {"Column2", each Text.BeforeDelimiter(_, "|"), type text},
          {"Column3", each Text.BeforeDelimiter(_, "|"), type text}
      })

If you need to, you can edit each of these transformations separately (like if different columns use different delimiters or need an entirely different transformation).

View solution in original post

5 REPLIES 5
v-angzheng-msft
Community Support
Community Support

Hi, @Anonymous 

May I ask if your problem has been solved? Is the above post helpful to you?

The above solutions will all work for you. If  it helps you, could you please mark the post which help as Answered? It will help the others in the community find the solution easily if they face the same problem with you. Thank you.

In addition, if there are multiple separators in one column, you can also try the Text.SplitAny function

 

 

Best Regards,
Community Support Team _ Zeon Zheng

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

CNENFRNL
Community Champion
Community Champion

 

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wys8sLU/VNTJW0lFKzMmuSUpWyAYykxSMdRRSdBSKi5ViYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ColA = _t, ColB = _t, ColC = _t]),
    
    Trfm = List.Accumulate(
        {
            [ColName="ColA",delim="-"],
            [ColName="ColB",delim="|"],
            [ColName="ColC",delim=","]
            // add as many ColName-delim pairs as you like
        },
        Source,
        (s,c) => Table.TransformColumns(s, {c[ColName], each Text.BeforeDelimiter(_, c[delim])})
    )
in
    Trfm

 

 


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

AlexisOlson
Super User
Super User

Select all of the columns you want to transform before applying Transform > Extract > Text.BeforeDelimiter and it should apply the step to all of the selected columns in a single step with M code that looks like this:

= Table.TransformColumns(Source,
      {
          {"Column1", each Text.BeforeDelimiter(_, "|"), type text},
          {"Column2", each Text.BeforeDelimiter(_, "|"), type text},
          {"Column3", each Text.BeforeDelimiter(_, "|"), type text}
      })

If you need to, you can edit each of these transformations separately (like if different columns use different delimiters or need an entirely different transformation).

Nice shot

Anonymous
Not applicable

This worked great, thanks for the help. 🙂

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.