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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Syndicate_Admin
Administrator
Administrator

Reemplazar varios valores en el Editor de consultas

Hola

Necesito reemplazar (en el editor de consultas) el nombre de todos los meses con el número del mes.

cristianml_0-1649387582544.png

cristianml_1-1649387657732.png

¿Cómo puedo escribir esto en un solo paso?

Ejemplo:

cristianml_2-1649387836058.png

Saludos.

2 ACCEPTED SOLUTIONS
Syndicate_Admin
Administrator
Administrator

@cristianml , Prueba

Date.ToText( Date.FromText(Text.BeforeDelimiter([Column1]," " ,{1, RelativePosition.FromStart})),"MM.yyyy") & " - " & Text.AfterDelimiter([Column1]," " ,{1, RelativePosition.FromStart})

ejemplo probado

Date.ToText( Date.FromText(Text.BeforeDelimiter("December 2022 Backlog"," " ,{1, RelativePosition.FromStart})),"MM.yyyy") & " - " & Text.AfterDelimiter("December 2022 Backlog"," " ,{1, RelativePosition.FromStart})

¿Puede proporcionar algunos datos en formato de texto?

View solution in original post

Syndicate_Admin
Administrator
Administrator

Hola @cristianml ,

Aquí está el código para hacerlo:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcklNTs1NSi1SMDIwMlRwSkzOzslPV4rViVZyS00qKk0sqgTJGKHIeCXmYZfwyy/DZlgsAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Split Column by Delimiter" = Table.SplitColumn(Source, "Column1", Splitter.SplitTextByEachDelimiter({" "}, QuoteStyle.Csv, false), {"Column1.1", "Text Column1.2"}),
  #"RepacedMonthName"  = Table.ReplaceValue(#"Split Column by Delimiter", each [Column1.1],  
each List.Accumulate(List.Buffer(Table.ToRecords(MasterTable)), 
     [Column1.1], 
      ( valueToReplace, replaceOldNewRecord ) => 
          Text.Replace
        ( valueToReplace, replaceOldNewRecord[Name], replaceOldNewRecord[Number] ) ),Replacer.ReplaceText,{"Column1.1"}),
    Custom1 = Table.AddColumn( #"RepacedMonthName", "RequiredColumn", each Text.Combine({Text.From([Column1.1], "es-ES"), [Text Column1.2]}, "."), type text),
    #"Removed Columns" = Table.RemoveColumns(Custom1,{"Column1.1", "Text Column1.2"})
in
    #"Removed Columns"

Adjuntando un archivo de muestra aquí para su referencia.

Espero que cumpla con su requisito.

View solution in original post

3 REPLIES 3
Syndicate_Admin
Administrator
Administrator

Hola @cristianml ,

Aquí está el código para hacerlo:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcklNTs1NSi1SMDIwMlRwSkzOzslPV4rViVZyS00qKk0sqgTJGKHIeCXmYZfwyy/DZlgsAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Split Column by Delimiter" = Table.SplitColumn(Source, "Column1", Splitter.SplitTextByEachDelimiter({" "}, QuoteStyle.Csv, false), {"Column1.1", "Text Column1.2"}),
  #"RepacedMonthName"  = Table.ReplaceValue(#"Split Column by Delimiter", each [Column1.1],  
each List.Accumulate(List.Buffer(Table.ToRecords(MasterTable)), 
     [Column1.1], 
      ( valueToReplace, replaceOldNewRecord ) => 
          Text.Replace
        ( valueToReplace, replaceOldNewRecord[Name], replaceOldNewRecord[Number] ) ),Replacer.ReplaceText,{"Column1.1"}),
    Custom1 = Table.AddColumn( #"RepacedMonthName", "RequiredColumn", each Text.Combine({Text.From([Column1.1], "es-ES"), [Text Column1.2]}, "."), type text),
    #"Removed Columns" = Table.RemoveColumns(Custom1,{"Column1.1", "Text Column1.2"})
in
    #"Removed Columns"

Adjuntando un archivo de muestra aquí para su referencia.

Espero que cumpla con su requisito.

Syndicate_Admin
Administrator
Administrator

@cristianml , Prueba

Date.ToText( Date.FromText(Text.BeforeDelimiter([Column1]," " ,{1, RelativePosition.FromStart})),"MM.yyyy") & " - " & Text.AfterDelimiter([Column1]," " ,{1, RelativePosition.FromStart})

ejemplo probado

Date.ToText( Date.FromText(Text.BeforeDelimiter("December 2022 Backlog"," " ,{1, RelativePosition.FromStart})),"MM.yyyy") & " - " & Text.AfterDelimiter("December 2022 Backlog"," " ,{1, RelativePosition.FromStart})

¿Puede proporcionar algunos datos en formato de texto?

@amitchandak ,

No funciona:

cristianml_0-1649422376637.png

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Solution Authors
Top Kudoed Authors