Forum Discussion

ratercero's avatar
ratercero
Icon for Helper III rankHelper III
9 years ago
Solved

Sort and Filter Append Query

Hello,

 

The Task is to append 3 queries, filter [Area Responsable]= "Tintoreria" and [Disposición] <> "Aprobado",  after this if duplicate "Lote" leave earliest result ( no duplicates)

I have been able to append the queries: 

let
    Source = Table.Combine({PNC_TELA, PNC_PARTES_CORTADAS, TONO_MALO}),
    #"Removed Other Columns" = Table.SelectColumns(Source,{"Fecha de Ingreso", "Lote", "Defecto 1", "Disposición", "Proceso Responsable"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Removed Other Columns",{{"Fecha de Ingreso", type date}})
in
    #"Changed Type"

 

 

One more question, Can I add a column to wach row telling me from which Database that line is from?

 

Thank you

8 Replies

  • Eric_Zhang's avatar
    Eric_Zhang
    Icon for Microsoft Employee rankMicrosoft Employee

    ratercero wrote:

    Hello,

     

    The Task is to append 3 queries, filter [Area Responsable]= "Tintoreria" and [Disposición] <> "Aprobado",  after this if duplicate "Lote" leave earliest result ( no duplicates)

    I have been able to append the queries: 

    let
        Source = Table.Combine({PNC_TELA, PNC_PARTES_CORTADAS, TONO_MALO}),
        #"Removed Other Columns" = Table.SelectColumns(Source,{"Fecha de Ingreso", "Lote", "Defecto 1", "Disposición", "Proceso Responsable"}),
        #"Changed Type" = Table.TransformColumnTypes(#"Removed Other Columns",{{"Fecha de Ingreso", type date}})
    in
        #"Changed Type"

     

     

    One more question, Can I add a column to wach row telling me from which Database that line is from?

     

    Thank you


    ratercero

    For the last question, you can add a column valuing the database name in each table before combining them.

    For the first question, could you please post some sample data for the 3 tables and expected output?