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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Split a column containing specific intervals

Hi all,

 

I'd like some help on splitting a column into two columns containing specific data. Right now, the column looks like this:

JanGoverde_1-1673433341251.png

after the numerals, there's specific abbreviations: ST & KG. 

I'd like to split the column into two columns One containing all the data with ST and one containing all the data with KG. 

Can anyone help me make this happen?

 

Much obliged!

 

 

1 ACCEPTED SOLUTION
AlB
Community Champion
Community Champion

@Anonymous 

Looks like your current last step is called  #"Removed Columns2". If so, you'd need to add the steps after (in the Advanced editor), making sure the first step "col_" reads from the correct step and column:

 


    col_ =  #"Removed Columns2"[Column7], 
    KG_col = List.Select(col_, each Text.Contains(_, "KG")),
    ST_col = List.Select(col_, each Text.Contains(_, "ST")),
    res_ = Table.FromColumns({KG_col, ST_col}, {"KG", "ST"})
in
    res_

 

If this does not work, do share your pbix

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

View solution in original post

3 REPLIES 3
AlB
Community Champion
Community Champion

@Anonymous 

Looks like your current last step is called  #"Removed Columns2". If so, you'd need to add the steps after (in the Advanced editor), making sure the first step "col_" reads from the correct step and column:

 


    col_ =  #"Removed Columns2"[Column7], 
    KG_col = List.Select(col_, each Text.Contains(_, "KG")),
    ST_col = List.Select(col_, each Text.Contains(_, "ST")),
    res_ = Table.FromColumns({KG_col, ST_col}, {"KG", "ST"})
in
    res_

 

If this does not work, do share your pbix

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

AlB
Community Champion
Community Champion

Hi @Anonymous 

Place the following M code in a blank query to see the steps.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTwdleK1YlWMtIzUggOATPBhDFMwkTPBEXCFCZhBhaOBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
    col_ =  #"Changed Type"[Column1], 
    KG_col = List.Select(col_, each Text.Contains(_, "KG")),
    ST_col = List.Select(col_, each Text.Contains(_, "ST")),
    res_ = Table.FromColumns({KG_col, ST_col}, {"KG", "ST"})
in
    res_

 

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

Anonymous
Not applicable

Hi, 

 

Many thanks for the quick response! Would you be willing to go a little more in-depth as to what and where I have to place the M code to get my desired outcome (I'm very new to this)?

This is the situation as a whole.

JanGoverde_0-1673438620816.png

Thanks again!

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

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

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.