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
destank
Employee
Employee

Flow Chart - estructuración de datos

Hola a todos

Me gustaría presentar acciones por usuario en el gráfico de flujo de Sankey visual personalizado. Este objeto visual requiere dos columnas: Origen y Destino.

Si consideramos el siguiente conjunto de datos que tiene columnas USER ID, timestamp y Action:

ID de usuarioTimestampAcción
114/05/2020 01:55:46Seleccione
114/05/2020 01:56:03Eliminar
214/05/2020 01:56:03Seleccione
313/05/2020 23:12:45Seleccione
313/05/2020 23:12:51actualizar
314/05/2020 23:12:55Seleccione

Necesito manipular este conjunto de datos para que tenga este aspecto:

ID de usuarioFuenteDestino
1SeleccioneEliminar
2Seleccione
3Seleccioneactualizar
3actualizarSeleccione

Intenté con la creación de una columna personalizada con DAX, pero de esta manera se queda sin memoria debido a un gran conjunto de datos:

Destino ( Destination)
var _cDate de la tabla [marca de tiempo]

var _calc - CALCULATE(MIN(Table[Action]),FILTER(ALLEXCEPT(Table,Table[User ID]),Table[timestamp]>_cDate))

retorno _calc

¿Hay alguna manera de manipular el conjunto de datos inicial en Power Query para obtener la salida deseada?

Gracias de antemano

1 ACCEPTED SOLUTION
v-xicai
Community Support
Community Support

Hola @destank ,

Puede agregar la columna Index( From 0 ) y, a continuación, agregar otra columna Index(From 1), combinar esta tabla con la tabla actual original, estableciendo más como abajo.

164.PNG

165.PNG

Let

    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTIw1Tc00TcyMDJQMDC0MjW1MjEDigan5qQmlyjF6mBVZGZlYAwUdQEqKkkFKzLCqQjJJGOoImOIIiNjK0MjKxNTIhSZghwRWpCSCLXOGNU6LCbFAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"User ID" = _t, timestamp = _t, Action = _t]),

    #"Changed Type" = Table.TransformColumnTypes(Source,{{"User ID", Int64.Type}, {"timestamp", type datetime}, {"Action", type text}}),

    #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 0, 1, Int64.Type),

    #"Added Index1" = Table.AddIndexColumn(#"Added Index", "Index.1", 1, 1, Int64.Type),

    #"Merged Queries" = Table.NestedJoin(#"Added Index1", {"User ID", "Index.1"}, #"Added Index1", {"User ID", "Index"}, "Added Index1", JoinKind.LeftOuter),

    #"Expanded Added Index1" = Table.ExpandTableColumn(#"Merged Queries", "Added Index1", {"Action"}, {"Added Index1.Action"}),

    #"Sorted Rows" = Table.Sort(#"Expanded Added Index1",{{"User ID", Order.Ascending}}),

    #"Removed Columns" = Table.RemoveColumns(#"Sorted Rows",{"Index", "Index.1"}),

    #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Action", "Source"}, {"Added Index1.Action", "destination"}})

in

    #"Renamed Columns"

Puede descargar el formulario pbix aquí.

Saludos

Amy

Equipo de apoyo a la comunidad _ Amy

Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

View solution in original post

2 REPLIES 2
v-xicai
Community Support
Community Support

Hola @destank ,

Puede agregar la columna Index( From 0 ) y, a continuación, agregar otra columna Index(From 1), combinar esta tabla con la tabla actual original, estableciendo más como abajo.

164.PNG

165.PNG

Let

    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTIw1Tc00TcyMDJQMDC0MjW1MjEDigan5qQmlyjF6mBVZGZlYAwUdQEqKkkFKzLCqQjJJGOoImOIIiNjK0MjKxNTIhSZghwRWpCSCLXOGNU6LCbFAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"User ID" = _t, timestamp = _t, Action = _t]),

    #"Changed Type" = Table.TransformColumnTypes(Source,{{"User ID", Int64.Type}, {"timestamp", type datetime}, {"Action", type text}}),

    #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 0, 1, Int64.Type),

    #"Added Index1" = Table.AddIndexColumn(#"Added Index", "Index.1", 1, 1, Int64.Type),

    #"Merged Queries" = Table.NestedJoin(#"Added Index1", {"User ID", "Index.1"}, #"Added Index1", {"User ID", "Index"}, "Added Index1", JoinKind.LeftOuter),

    #"Expanded Added Index1" = Table.ExpandTableColumn(#"Merged Queries", "Added Index1", {"Action"}, {"Added Index1.Action"}),

    #"Sorted Rows" = Table.Sort(#"Expanded Added Index1",{{"User ID", Order.Ascending}}),

    #"Removed Columns" = Table.RemoveColumns(#"Sorted Rows",{"Index", "Index.1"}),

    #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Action", "Source"}, {"Added Index1.Action", "destination"}})

in

    #"Renamed Columns"

Puede descargar el formulario pbix aquí.

Saludos

Amy

Equipo de apoyo a la comunidad _ Amy

Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

Gracias Amy!

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.