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.
Hola tengo un conjunto de datos como el siguiente. Puedo combinar manualmente las columnas para que sea como uno. ¿Es posible escribir una condición para combinar las columnas?
Ejemplo: si el nombre del encabezado de columna contiene Type, combine todas esas columnas para crear una nueva columna.
Repollo 1 | Repollo 2 | Repollo 3 | Tipo-123 | Tipo-456 | Repollo 8 | Repollo 10 |
Solved! Go to Solution.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcjRS0lGCIBOfYBDp7O0CpCx9gIS/v79SbCwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Col 1" = _t, #"Type-000" = _t, #"Type-001" = _t, #"Type-123" = _t, #"Type-456" = _t, #"Col 8" = _t, #"Col 10" = _t]),
#"Combined Columns" = Table.CombineColumns(Source, List.Select(Table.ColumnNames(Source), each Text.Contains(_, "Type")), each Text.Combine(List.RemoveItems(_, {null, ""}), "|"), "Combined")
in
#"Combined Columns"
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcjRS0lGCIBOfYBDp7O0CpCx9gIS/v79SbCwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Col 1" = _t, #"Type-000" = _t, #"Type-001" = _t, #"Type-123" = _t, #"Type-456" = _t, #"Col 8" = _t, #"Col 10" = _t]),
#"Combined Columns" = Table.CombineColumns(Source, List.Select(Table.ColumnNames(Source), each Text.Contains(_, "Type")), each Text.Combine(List.RemoveItems(_, {null, ""}), "|"), "Combined")
in
#"Combined Columns"
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcjRS0lHycQwDkiaGLiDSJxhEOnuDOJY+QMLf318pNhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Col 1" = _t, #"Col 2" = _t, #"Col 3" = _t, #"Type-123" = _t, #"Type-456" = _t, #"Col 8" = _t, #"Col 10" = _t]),
#"Combined Columns" = Table.CombineColumns(Source, List.Select(Table.ColumnNames(Source), each Text.Contains(_, "Type")), Combiner.CombineTextByDelimiter("|", QuoteStyle.Csv), "Combined")
in
#"Combined Columns"
Esto está funcionando, pero estoy recibiendo |||| 4LS|4CKD ya que tengo null para las columnas anteriores (con encabezados Type). ¿Podemos agregar una condición para evitar celdas nulas?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
2 | |
2 | |
2 | |
2 | |
1 |