Forum Discussion
Sort and Filter Append Query
- 9 years ago
You can sort on date and than remove duplicates as illustrated in this short video.
ratercero: the question was already answered by Eric_Zhang:
"For the last question, you can add a column valuing the database name in each table before combining them."
Translated into code, e.g.:
let
Source1 = Table.AddColumn(PNC_TELA, "Source", each "PNC_TELA"),
Source2 = Table.AddColumn(PNC_PARTES_CORTADAS, "Source", each "PNC_PARTES_CORTADAS"),
Source3 = Table.AddColumn(TONO_MALO, "Source", each "TONO_MALO"),
Source = Table.Combine({Source1, Source2, Source3}),
#"Removed Other Columns" = Table.SelectColumns(Source,{"Fecha de Ingreso", "Lote", "Defecto 1", "Disposición", "Proceso Responsable", "Source"}),
#"Changed Type" = Table.TransformColumnTypes(#"Removed Other Columns",{{"Fecha de Ingreso", type date}})
in
#"Changed Type"
Hello MarcelBeug,
I used Eric_Zhang recomendation and this is my code:
let
Source1 = Table.AddColumn(PNC_TELA, "Source", each "PNC_TELA"),
Source2 = Table.AddColumn(PNC_PARTES_CORTADAS, "Source", each "PNC_PARTES_CORTADAS"),
Source3 = Table.AddColumn(TONO_MALO, "Source", each "TONO_MALO"),
Source = Table.Combine({Source1, Source2, Source3}),
#"Removed Other Columns" = Table.SelectColumns(Source,{"Fecha de Ingreso", "Lote", "Defecto 1", "Disposición", "Proceso Responsable", "Source"}),
#"ChangedType" = Table.TransformColumnTypes(#"Removed Other Columns",{{"Fecha de Ingreso", type date}}),
#"Filtered Table" =Table.SelectRows(ChangedType, each [Proceso Responsable] = "Tintoreria" and [Disposición]<>"Aprobado" )
in
#"Filtered Table"
It partially works for my final objective since I need to only the first time a batch # shows and
[Proceso Responsable] = "Tintoreria" and [Disposición]<>"Aprobado"
, if it repeats with another defects the current code is leaving that entry too.
- MarcelBeug9 years agoCommunity Champion
You can sort on date and than remove duplicates as illustrated in this short video.
- ratercero9 years agoHelper III
MarcelBeug , will I have to do this everytime I do the refresh?
- MarcelBeug9 years agoCommunity Champion
No: just add these steps to your query, so it will be part of the refresh.