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
Syndicate_Admin
Administrator
Administrator

Cualquiera sabe cómo analizar un texto y almacenarlo en una nueva columna

Hola, he estado tratando de averiguar la mejor manera de analizar el lote mfg de un grupo de números de serie. Cuatro números consecutivos (los valores de lugar son 7-10, como se muestra a continuación)

Mobartle_0-1621886394558.png

Los dos primeros lugares son para la semana y el segundo para el año. ¿Alguien puede mostrarme cómo lograr esto? ¿Un cálculo Dax? ¿algo?

1 ACCEPTED SOLUTION
Syndicate_Admin
Administrator
Administrator

Ahí @Mobartle,

Esto debe hacer el truco...

let
  Source = Table.FromRows(
    Json.Document(
      Binary.Decompress(
        Binary.FromText("i45WMjAyNjXyMDUwNPcwMDC1MFaKjQUA", 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}}), 
  #"Inserted Text Range" = Table.AddColumn(
    #"Changed Type", 
    "Text Range", 
    each Text.Middle([Column1], 6, 4), 
    type text
  )
in
  #"Inserted Text Range"

La clave es Text.Middle.

Espero que esto ayude.

View solution in original post

3 REPLIES 3
Syndicate_Admin
Administrator
Administrator

hola

Esta fórmula de columna calculada debe funcionar

=mid(Datos[texto],7,4)

Syndicate_Admin
Administrator
Administrator

Ahí @Mobartle,

Esto debe hacer el truco...

let
  Source = Table.FromRows(
    Json.Document(
      Binary.Decompress(
        Binary.FromText("i45WMjAyNjXyMDUwNPcwMDC1MFaKjQUA", 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}}), 
  #"Inserted Text Range" = Table.AddColumn(
    #"Changed Type", 
    "Text Range", 
    each Text.Middle([Column1], 6, 4), 
    type text
  )
in
  #"Inserted Text Range"

La clave es Text.Middle.

Espero que esto ayude.

¡Gracias! ¡¡Funcionó perfecto!!

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.