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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Split/Extract text from last delimiter - right to left

Hey guys,

 

i have this kinda data:

  •  

    item

    1

    1.1
    1.2
    1.2.1
    1.2.2
    1.3
    1.3.1

    1.3.2

    1.3.3

    1.3.4

    1.3.4.1
    1.3.4.2
    1.3.4.2.1
    1.3.4.2.1
    2
    2.1

i want to extract 1 number before the last "."(dot/point) (between the last two ".")

The 'new' column should be like this:

item

extracted number

1

null

1.11
1.21
1.2.12
1.2.22
1.31
1.3.13

1.3.2

3

1.3.3

3

1.3.4

3

1.3.4.14
1.3.4.24
1.3.4.2.12
1.3.4.2.12
2null
2.12

note: some items of it ends up with two characters... 22.1.1.10

how can i do this kinda thing?

1 ACCEPTED SOLUTION
camargos88
Community Champion
Community Champion

@Anonymous ,

 

Capture.PNG

 

Did I answer your question? Mark my post as a solution!
Ricardo



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



View solution in original post

2 REPLIES 2
camargos88
Community Champion
Community Champion

@Anonymous ,

 

Capture.PNG

 

Did I answer your question? Mark my post as a solution!
Ricardo



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Greg_Deckler
Community Champion
Community Champion

Maybe:

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WyixJzVWK1YlWMoSQejDaCEYjROBixjAaLmeMkEOSNUGwkFSaIKk1QTIfzosFAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
    #"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
    #"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"item", type text}}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Changed Type1", "item", Splitter.SplitTextByEachDelimiter({"."}, QuoteStyle.Csv, true), {"item.1", "item.2"}),
    #"Changed Type2" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"item.1", type text}, {"item.2", Int64.Type}}),
    #"Split Column by Delimiter1" = Table.SplitColumn(#"Changed Type2", "item.1", Splitter.SplitTextByEachDelimiter({"."}, QuoteStyle.Csv, true), {"item.1.1", "item.1.2"}),
    #"Changed Type3" = Table.TransformColumnTypes(#"Split Column by Delimiter1",{{"item.1.1", type text}, {"item.1.2", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type3", "Custom", each if [item.2] = null and [item.1.2] = null then [item.1.1] else if [item.1.2] = null then [item.2] else [item.1.2]),
    #"Changed Type4" = Table.TransformColumnTypes(#"Added Custom",{{"Custom", Int64.Type}})
in
    #"Changed Type4"


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors