Hola.
Este es mi problema:
Producto | Fecha de entrega cambiada en | Fecha de entrega antigua |
A | 2/1/20 | 5/15/20 |
A | 3/1/20 | 5/20/20 |
A | 4/1/20 | 5/16/20 |
La salida que estoy buscando es
Por lo tanto, Agrupar Min y luego Todas las filas no me dan la respuesta.
¿Alguna sugerencia? ¿Función tabla? ¿Función de lista?
Gracias por su ayuda
Solved! Go to Solution.
Hola @JMSNYC
puede usar Table.Group y usar un Table.SelectRows en él.
Aquí un ejemplo completo. Echa un vistazo al paso "Filas agrupadas" que hace el truco
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTLSN9Q3MgAyTPUNTUGsWB2IhDFCwsgAWcIESYcZWCIWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Product = _t, #"Delivery Date Changed On" = _t, #"Old Delivery Date" = _t]),
DateFormat = Table.TransformColumns
(
Source,
{
{
"Delivery Date Changed On",
each Date.From(_,"en-US"),
type date
},
{
"Old Delivery Date",
each Date.From(_,"en-US"),
type date
}
}
),
#"Grouped Rows" = Table.Group(DateFormat, {"Product"}, {{"Min Date", each Table.SelectRows(_, (sel)=> sel[Delivery Date Changed On]= List.Min(_[Delivery Date Changed On])), type table [Product=text, Delivery Date Changed On=date, Old Delivery Date=date]}}),
#"Expanded Min Date" = Table.ExpandTableColumn(#"Grouped Rows", "Min Date", {"Delivery Date Changed On", "Old Delivery Date"}, {"Delivery Date Changed On", "Old Delivery Date"})
in
#"Expanded Min Date"
Copie pegue este código en el editor avanzado en una nueva consulta en blanco para ver cómo funciona la solución.
Si este post ayuda o resuelve su problema, márquelo como solución (para ayudar a otros usuarios a encontrar contenido útil y para reconocer el trabajo de los usuarios que le ayudaron)
Los Kudoes también son agradables.
Que te diviertas
Jimmy
Hola @JMSNYC
puede usar Table.Group y usar un Table.SelectRows en él.
Aquí un ejemplo completo. Echa un vistazo al paso "Filas agrupadas" que hace el truco
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTLSN9Q3MgAyTPUNTUGsWB2IhDFCwsgAWcIESYcZWCIWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Product = _t, #"Delivery Date Changed On" = _t, #"Old Delivery Date" = _t]),
DateFormat = Table.TransformColumns
(
Source,
{
{
"Delivery Date Changed On",
each Date.From(_,"en-US"),
type date
},
{
"Old Delivery Date",
each Date.From(_,"en-US"),
type date
}
}
),
#"Grouped Rows" = Table.Group(DateFormat, {"Product"}, {{"Min Date", each Table.SelectRows(_, (sel)=> sel[Delivery Date Changed On]= List.Min(_[Delivery Date Changed On])), type table [Product=text, Delivery Date Changed On=date, Old Delivery Date=date]}}),
#"Expanded Min Date" = Table.ExpandTableColumn(#"Grouped Rows", "Min Date", {"Delivery Date Changed On", "Old Delivery Date"}, {"Delivery Date Changed On", "Old Delivery Date"})
in
#"Expanded Min Date"
Copie pegue este código en el editor avanzado en una nueva consulta en blanco para ver cómo funciona la solución.
Si este post ayuda o resuelve su problema, márquelo como solución (para ayudar a otros usuarios a encontrar contenido útil y para reconocer el trabajo de los usuarios que le ayudaron)
Los Kudoes también son agradables.
Que te diviertas
Jimmy
Esto es increíble !! Funciona perfectamente. Muchas gracias y muchos elogios.
Has this post solved your problem? Please mark it as a solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos.
I work as a trainer and consultant for Microsoft 365, specialising in Power BI and Power Query.