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
Antmkjr
Post Patron
Post Patron

Delimiter issue

I have a table like this:

Name DateType 
A7-Jan-25
10-Jan-25
25-Jan-25
25-Jan-25
bus
B car
C ship
D car

 

And expected output is:,how to do this in power query

 

Name DateType 
A07-Jan-25bus
B10-Jan-25car
C25-Jan-25ship
D25-Jan-25car
   
2 ACCEPTED SOLUTIONS
dufoq3
Community Champion
Community Champion

Hi @Antmkjr, check this:

 

Output

dufoq3_0-1726910758364.png

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTLX9UrM0zUyjckzNIAzjUwxmUC1SaXFSrE60UpOQDYQJScWgbnOEG5xRmYBmO+CJB0LAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t, Date = _t, Type = _t]),
    ColumnsToList = Table.TransformColumns(Source, {}, each List.Select(Text.Split(_, "#(lf)"), (x)=> not List.Contains({"null", ""}, x)) ),
    ColNames = Table.ColumnNames(ColumnsToList),
    Records = List.Buffer(Table.ToRecords(ColumnsToList)),
    Lg = List.Generate(
        ()=> [ x = 0, rec = List.Transform(ColNames, (w)=> Record.FieldOrDefault(Records{x}, w){0}?) ],
        each [x] < List.Count(Records),
        each [ x = [x]+1, rec = List.Transform(ColNames, (w)=> Record.FieldOrDefault(Records{x}, w){0}? ?? Record.FieldOrDefault(Records{0}, w){x}? ) ],
        each [rec]
),
    ToTable = Table.FromRows(Lg, ColNames)
in
    ToTable

 


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

View solution in original post

Ahmedx
Super User
Super User

pls try this

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTLX9UrM0zUyjckzNIAzjUwxmUC1SaXFSrE60UpOQDYQJScWgbnOEG5xRmYBmO+CJB0LAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t, Date = _t, Type = _t]),
    Replace = Table.ReplaceValue(Source, (x)=>x,(x)=>x, (x,y,z)=>Text.Split(Source[Date]{0}, "#(lf)")  ,{"Date"}),
    Index = Table.AddIndexColumn(Replace, "Index", 0, 1, Int64.Type),
    AddColumn = Table.AddColumn(Index, "tmp", each [Date]{[Index]}),
   RemoveCol= Table.RemoveColumns(AddColumn,{"Date", "Index"})
in
    RemoveCol

View solution in original post

4 REPLIES 4
Omid_Motamedise
Super User
Super User

Please check this one

let
    Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],
    Custom1 = Table.FromColumns({ Source[Name ],Text.Split(Source[Date]{0},"#(lf)"),Source[Type]})
in
    Custom1

If my answer helped solve your issue, please consider marking it as the accepted solution.
Omid_Motamedise
Super User
Super User

To solve this problem, select column Date and go to home tab and then pick split column command (by delimiter) with the below setting

Omid_Motamedise_0-1727044126934.png

 

to reach your solution


If my answer helped solve your issue, please consider marking it as the accepted solution.
Ahmedx
Super User
Super User

pls try this

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTLX9UrM0zUyjckzNIAzjUwxmUC1SaXFSrE60UpOQDYQJScWgbnOEG5xRmYBmO+CJB0LAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t, Date = _t, Type = _t]),
    Replace = Table.ReplaceValue(Source, (x)=>x,(x)=>x, (x,y,z)=>Text.Split(Source[Date]{0}, "#(lf)")  ,{"Date"}),
    Index = Table.AddIndexColumn(Replace, "Index", 0, 1, Int64.Type),
    AddColumn = Table.AddColumn(Index, "tmp", each [Date]{[Index]}),
   RemoveCol= Table.RemoveColumns(AddColumn,{"Date", "Index"})
in
    RemoveCol
dufoq3
Community Champion
Community Champion

Hi @Antmkjr, check this:

 

Output

dufoq3_0-1726910758364.png

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTLX9UrM0zUyjckzNIAzjUwxmUC1SaXFSrE60UpOQDYQJScWgbnOEG5xRmYBmO+CJB0LAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t, Date = _t, Type = _t]),
    ColumnsToList = Table.TransformColumns(Source, {}, each List.Select(Text.Split(_, "#(lf)"), (x)=> not List.Contains({"null", ""}, x)) ),
    ColNames = Table.ColumnNames(ColumnsToList),
    Records = List.Buffer(Table.ToRecords(ColumnsToList)),
    Lg = List.Generate(
        ()=> [ x = 0, rec = List.Transform(ColNames, (w)=> Record.FieldOrDefault(Records{x}, w){0}?) ],
        each [x] < List.Count(Records),
        each [ x = [x]+1, rec = List.Transform(ColNames, (w)=> Record.FieldOrDefault(Records{x}, w){0}? ?? Record.FieldOrDefault(Records{0}, w){x}? ) ],
        each [rec]
),
    ToTable = Table.FromRows(Lg, ColNames)
in
    ToTable

 


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

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.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.