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 una serie de columnas (40) para las que quiero calcular la varianza con la columna anterior. ¿Cómo utilizo 'loop' en una función para obtener lo que necesito? Es ese un mejor enfoque, puedo tener más de 1M+ registros.
Mis columnas originales están en A thru E, estaba planeando fusionarlas en la columna G (pensé que era lógico realizar bucle en una cadena separada por comas).
Tal vez utilice una función para obtener la columna N y luego dividirla para obtener las columnas deseadas P thru S.
Los valores son incremant (Col B thru E)
Gracias
Solved! Go to Solution.
No @F75
Coloque el siguiente código M en una consulta en blanco para ver los pasos. Véalo todo en el archivo adjunto.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8nNU0lEyNAASUBSrE63k6gsWNUIV9QELmgAJI0MkYf+SjNQikIwZSMYYRFjC5MCmG5tiM90Em+nmIIeYm2Mx3QJkiCVIj6UFihZLkBZLc7AvQJYbGpoqxcYCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Region = _t, Column2 = _t, Column3 = _t, Column4 = _t, Column5 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Region", type text}, {"Column2", Int64.Type}, {"Column3", Int64.Type}, {"Column4", Int64.Type}, {"Column5", Int64.Type}}),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Region"}, "Attribute", "Value"),
#"Grouped Rows" = Table.Group(#"Unpivoted Other Columns", {"Region"}, {{"Grouped", each [Value] }}, GroupKind.Local),
#"Added Custom1" = Table.AddColumn(#"Grouped Rows", "Custom", each let aux1_ = [Grouped], aux2_ = {0} & List.RemoveLastN(aux1_,1), aux_ = List.Transform(List.Zip({aux1_, aux2_}), each _{0} - _{1}) in aux_),
#"Extracted Values" = Table.TransformColumns(#"Added Custom1", {"Custom", each Text.Combine(List.Transform(_, Text.From), ","), type text}),
#"Split Column by Delimiter" = Table.SplitColumn(#"Extracted Values", "Custom", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Custom.1", "Custom.2", "Custom.3", "Custom.4"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Custom.1", Int64.Type}, {"Custom.2", Int64.Type}, {"Custom.3", Int64.Type}, {"Custom.4", Int64.Type}}),
#"Removed Columns" = Table.RemoveColumns(#"Changed Type1",{"Grouped"})
in
#"Removed Columns"
|
Por favor, acepte la solución cuando haya terminado y considere la posibilidad de dar un pulgar hacia arriba si las publicaciones son útiles. Póngase en contacto conmigo de forma privada para obtener soporte con cualquier necesidad de BI a mayor escala, tutoría, etc. |
No @F75
Coloque el siguiente código M en una consulta en blanco para ver los pasos. Véalo todo en el archivo adjunto.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8nNU0lEyNAASUBSrE63k6gsWNUIV9QELmgAJI0MkYf+SjNQikIwZSMYYRFjC5MCmG5tiM90Em+nmIIeYm2Mx3QJkiCVIj6UFihZLkBZLc7AvQJYbGpoqxcYCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Region = _t, Column2 = _t, Column3 = _t, Column4 = _t, Column5 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Region", type text}, {"Column2", Int64.Type}, {"Column3", Int64.Type}, {"Column4", Int64.Type}, {"Column5", Int64.Type}}),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Region"}, "Attribute", "Value"),
#"Grouped Rows" = Table.Group(#"Unpivoted Other Columns", {"Region"}, {{"Grouped", each [Value] }}, GroupKind.Local),
#"Added Custom1" = Table.AddColumn(#"Grouped Rows", "Custom", each let aux1_ = [Grouped], aux2_ = {0} & List.RemoveLastN(aux1_,1), aux_ = List.Transform(List.Zip({aux1_, aux2_}), each _{0} - _{1}) in aux_),
#"Extracted Values" = Table.TransformColumns(#"Added Custom1", {"Custom", each Text.Combine(List.Transform(_, Text.From), ","), type text}),
#"Split Column by Delimiter" = Table.SplitColumn(#"Extracted Values", "Custom", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Custom.1", "Custom.2", "Custom.3", "Custom.4"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Custom.1", Int64.Type}, {"Custom.2", Int64.Type}, {"Custom.3", Int64.Type}, {"Custom.4", Int64.Type}}),
#"Removed Columns" = Table.RemoveColumns(#"Changed Type1",{"Grouped"})
in
#"Removed Columns"
|
Por favor, acepte la solución cuando haya terminado y considere la posibilidad de dar un pulgar hacia arriba si las publicaciones son útiles. Póngase en contacto conmigo de forma privada para obtener soporte con cualquier necesidad de BI a mayor escala, tutoría, etc. |
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 | |
1 | |
1 | |
1 | |
1 |
User | Count |
---|---|
2 | |
2 | |
2 | |
2 | |
1 |