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.
Estoy tratando de encontrar una manera de filtrar duplicados en el valor del mes
Si el valor del mes es 1 , mantenga el 1er identificador duplicado
Si el valor del mes es 2 , mantenga el segundo identificador duplicado
Si el valor del mes es 3 , mantenga el 3er identificador duplicado
Los datos tienen identificadores duplicados para cada período
ID Mes Dep Arr
305 1 11:50 13:25
303 1 08:05 09:40
301 1 07:05 08:40
305 2 11:25 13:00
303 2 09:05 10:40
301 2 06:05 07:40
305 3 10:20 11:45
303 3 06:05 07:40
301 3 08:15 09:55
Entonces, si el mes es igual a 3, entonces manténgase solo
305 3 10:20 11:45
303 3 06:05 07:40
301 3 08:15 09:55
Esperaba obtener el número de mes indexando duplicados, por lo que el primer duplicado sería 1, 2º 2 y 3º 3º. y luego diga si mes = 3 entonces sólo mantenga duplicados indexados 3
Solved! Go to Solution.
¿Quiere decir que los valores de los campos de mes no están realmente incluidos en sus tablas, verdad? Si ese es el caso, puede intentar agrupar el registro por ID y anidar la función 'agregar índice' en la función de grupo en el lado del editor de consultas.
Consulta completa:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("hY87DoAwDEOvgjJ3cNoG2mwcoBI74v7XgPKpwkditPXkJ88zBQg5YlaBAt1YalIvNUyFFleRsJVJIY3IGi/8IHgrB0ukJ3FqvBgN8NJkO8L48vQWGT49UG/usEa5MeF3hfcLbB9L21hW", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Dep = _t, Arr = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Dep", type time}, {"Arr", type time}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"ID"}, {{"Content", each Table.AddIndexColumn(_,"Month",1,1), type table [ID=nullable number, Dep=nullable time, Arr=nullable time]}}),
#"Expanded Content" = Table.ExpandTableColumn(#"Grouped Rows", "Content", {"Dep", "Arr","Month"}, {"Dep", "Arr","Month"}),
#"Sorted Rows" = Table.Sort(#"Expanded Content",{{"Month", Order.Ascending}})
in
#"Sorted Rows"
Saludos
Xiaoxin Sheng
Puede hacerlo agregando un filtro a su columna Mes (por ejemplo, filtrarlo a 3) y luego reemplazando el 3 en la barra de fórmulas con el texto rojo a continuación. Esto lo filtrará dinámicamente al mes actual. Para su información, deberá adaptarlo si tiene más de un año de datos.
= Table.SelectRows(#"Tipo modificado", cada uno ([Mes] = Fecha.Mes(Fecha.Desde(FechaHora.LocalNow()))))
Palmadita
¿Cómo obtengo un índice para duplicados, para que pueda agregar un 1, 2 o 3 en la columna del mes, por lo que el primer duplicado es 1, el segundo duplicado es 2 y el 3er duplicado es 3
ID Mes Dep Arr
305 1 11:50 13:25
303 1 08:05 09:40
301 1 07:05 08:40
305 2 11:25 13:00
303 2 09:05 10:40
301 2 06:05 07:40
305 3 10:20 11:45
303 3 06:05 07:40
301 3 08:15 09:55
¿Quiere decir que los valores de los campos de mes no están realmente incluidos en sus tablas, verdad? Si ese es el caso, puede intentar agrupar el registro por ID y anidar la función 'agregar índice' en la función de grupo en el lado del editor de consultas.
Consulta completa:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("hY87DoAwDEOvgjJ3cNoG2mwcoBI74v7XgPKpwkditPXkJ88zBQg5YlaBAt1YalIvNUyFFleRsJVJIY3IGi/8IHgrB0ukJ3FqvBgN8NJkO8L48vQWGT49UG/usEa5MeF3hfcLbB9L21hW", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Dep = _t, Arr = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Dep", type time}, {"Arr", type time}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"ID"}, {{"Content", each Table.AddIndexColumn(_,"Month",1,1), type table [ID=nullable number, Dep=nullable time, Arr=nullable time]}}),
#"Expanded Content" = Table.ExpandTableColumn(#"Grouped Rows", "Content", {"Dep", "Arr","Month"}, {"Dep", "Arr","Month"}),
#"Sorted Rows" = Table.Sort(#"Expanded Content",{{"Month", Order.Ascending}})
in
#"Sorted Rows"
Saludos
Xiaoxin Sheng
Thanks , that worked perfectly
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 |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |