cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Dividir/Extraer texto del último delimitador - de derecha a izquierda

Hola, chicos

Tengo este tipo de datos:

  • Artículo

    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

Quiero extraer 1 número antes del último "." (punto/punto) (entre los dos últimos ".")

La columna 'nuevo' debe ser así:

Artículo

número extraído

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

Nota: algunos elementos de ella terminan con dos personajes... 22.1.1.10

¿Cómo puedo hacer este tipo de cosas?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Champion
Community Champion

Re: Dividir/Extraer texto del último delimitador - de derecha a izquierda

@kimmdcruz ,

Capture.PNG

¿Respondí a tu pregunta? ¡Marca mi puesto como solución!
Ricardo


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

View solution in original post

2 REPLIES 2
Highlighted
Super User IV
Super User IV

Re: Dividir/Extraer texto del último delimitador - de derecha a izquierda

quizás:

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"

---------------------------------------

Putting square pegs in round holes since 1972.

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




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

Proud to be a Super User!




Highlighted
Community Champion
Community Champion

Re: Dividir/Extraer texto del último delimitador - de derecha a izquierda

@kimmdcruz ,

Capture.PNG

¿Respondí a tu pregunta? ¡Marca mi puesto como solución!
Ricardo


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

View solution in original post

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Upcoming Events

Upcoming Events

Wondering what events you could join or have an event to promote yourself? Check out our Upcoming Events.

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

We are thrilled to announce we will begin running a monthly webinar series named Power BI Dev Camp.