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

Split a column and sort

Hello there. Hope everyone is well. Please see below... Would be great if someone hepled me with this.

 

Current Situation: All my data is in one column.

A00
A00.0
A00.1
A00.9
A01
A01.0
A01.1
A01.2

 

Desired Outcome:

A00A00.0
A00A00.1
A00A00.9
A01A01.0
A01A01.1
A01A01.2

 

Does anyone know how to archieve this split and allocation in PowerBI?

 

 

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @Anonymous ,

 

You can do this in Query Editor, check the query below.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcjQwUIrVAdN6CJYhnGUJZcFEDOGqDPUQYkZKsbEA", 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}}),
    #"Duplicated Column" = Table.DuplicateColumn(#"Changed Type", "Column1", "Column1 - Copy"),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Duplicated Column", "Column1 - Copy", Splitter.SplitTextByDelimiter(".", QuoteStyle.Csv), {"Column1 - Copy.1", "Column1 - Copy.2"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Column1 - Copy.1", type text}, {"Column1 - Copy.2", Int64.Type}}),
    #"Filtered Rows" = Table.SelectRows(#"Changed Type1", each [#"Column1 - Copy.2"] <> null and [#"Column1 - Copy.2"] <> ""),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Column1 - Copy.2"}),
    #"Reordered Columns" = Table.ReorderColumns(#"Removed Columns",{"Column1 - Copy.1", "Column1"})
in
    #"Reordered Columns"

You will need to dumplicate the column first then use split column feature then remove empty rows and at lase remove extra cloumn.

1.PNG

Pbix as attached.

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

2 REPLIES 2
v-jayw-msft
Community Support
Community Support

Hi @Anonymous ,

 

You can do this in Query Editor, check the query below.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcjQwUIrVAdN6CJYhnGUJZcFEDOGqDPUQYkZKsbEA", 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}}),
    #"Duplicated Column" = Table.DuplicateColumn(#"Changed Type", "Column1", "Column1 - Copy"),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Duplicated Column", "Column1 - Copy", Splitter.SplitTextByDelimiter(".", QuoteStyle.Csv), {"Column1 - Copy.1", "Column1 - Copy.2"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Column1 - Copy.1", type text}, {"Column1 - Copy.2", Int64.Type}}),
    #"Filtered Rows" = Table.SelectRows(#"Changed Type1", each [#"Column1 - Copy.2"] <> null and [#"Column1 - Copy.2"] <> ""),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Column1 - Copy.2"}),
    #"Reordered Columns" = Table.ReorderColumns(#"Removed Columns",{"Column1 - Copy.1", "Column1"})
in
    #"Reordered Columns"

You will need to dumplicate the column first then use split column feature then remove empty rows and at lase remove extra cloumn.

1.PNG

Pbix as attached.

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
amitchandak
Super User
Super User

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.