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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors