Forum Discussion

User57639205's avatar
User57639205
Frequent Visitor
2 years ago
Solved

Power Query Group by Earliest occurrence another date field

I would like to filter my data so i only have the unique quality deadline dates by product ID and the earliest Log Date they first appeared.

 

So each day we recieve a log of product quality checks, the quality team will sometimes modify the deadline date, however we do not have clear record the dates when quality check deadline has been amended. So within Power Query would like to identify for each unique product ID the unique Quality Check Deadline date and the corresponding earliest log date to match this.

 

Product IDQuality Check DeadlineLog Date 
109/10/202401/07/2024
109/10/202430/06/2024
109/10/202429/06/2024
109/10/202428/06/2024
109/10/202427/06/2024
104/09/202426/06/2024
104/09/202425/06/2024
104/09/202424/06/2024
117/08/202423/06/2024
117/08/202422/06/2024
212/09/202401/07/2024
212/09/202430/06/2024
212/09/202429/06/2024
201/09/202428/06/2024
201/09/202427/06/2024
201/09/202426/06/2024
201/09/202425/06/2024
210/08/202424/06/2024
210/08/202423/06/2024

 

so based on table above would aim to achieve following 

 

Product IDQuality Check DeadlineDeadline Updated
109/10/202427/06/2024
104/09/202424/06/2024
117/08/202422/06/2024
212/09/202429/06/2024
201/09/202425/06/2024
210/08/202423/06/2024



  • Anonymous's avatar
    Anonymous
    2 years ago

    Hola. Sigues con la agrupacion. Agrupas de modo avanzado. Seleccionas solo la columna Product ID. Solo trae una agregacion, presionas el boton de "Agregar agregación". Para tener las dos columnas Quality Check Deadline y Log Date. En la primera tabla defines minimo y en la segunda tabla defines maximo para las dos columnas a agregar.

     

    Tabla 1.

     

    Tabla 2.

     

    ¿Si respondí tu pregunta? ¡Recuerda marca mi publicación como la solución!

     

4 Replies

  • Create a Blank Query and use the below M Code and test this out.

     

    let
        Source = Table,
        GroupedRows = Table.Group(Source, {"Product ID", "Quality Check Deadline"}, {{"Deadline Updated", each List.Min([Log_Date]), type date}})
    in
        GroupedRows
    • User57639205's avatar
      User57639205
      Frequent Visitor

      Thank you so much, this has worked perfectly

       

      I now wish to create two duplicates of this table one for the earliest deadline updated date by product ID and include the associated quality check deadline on this date and the other one would be the latest deadline updated date.

       

      So two seperate tables

      Product IDQuality Check DeadlineEarliest Deadline Updated
      117/08/202422/06/2024
      210/08/202423/06/2024

       

      Product IDQuality Check DeadlineLatest Deadline Updated
      109/10/202427/06/2024
      212/09/202429/06/2024

       

       

       

       

       

       

       

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hola. Sigues con la agrupacion. Agrupas de modo avanzado. Seleccionas solo la columna Product ID. Solo trae una agregacion, presionas el boton de "Agregar agregación". Para tener las dos columnas Quality Check Deadline y Log Date. En la primera tabla defines minimo y en la segunda tabla defines maximo para las dos columnas a agregar.

         

        Tabla 1.

         

        Tabla 2.

         

        ¿Si respondí tu pregunta? ¡Recuerda marca mi publicación como la solución!

         

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hola. Intenta con esta agrupacion. Debes seleccionar las dos columnas Product ID  y Quality Check Deadline. Luego clic derecho y seleccionas "agrupar por" y haces los pasos de la imagen. Importante, seleccionar Operacion MIN de la columna Long Date.

     

     

    ¿Si respondí tu pregunta? ¡Recuerda marca mi publicación como la solución!