Forum Discussion
Max date by article
- 6 years agoDid you try to sort the column of the Date Prior the Group-function?
- 6 years ago
it work like this
let
Origem = Odbc.DataSource("dsn=inout.swapfilio", [HierarchicalNavigation=true]),
B606D19C_Database = Origem{[Name="B606D19C",Kind="Database"]}[Data],
SWAPFILIO_Schema = B606D19C_Database{[Name="SWAPFILIO",Kind="Schema"]}[Data],
GEFPR_Table = SWAPFILIO_Schema{[Name="GEFPR",Kind="Table"]}[Data],
#"Linhas Filtradas" = Table.SelectRows(GEFPR_Table, each [SOCDPR] = 1),
#"Linhas Filtradas1" = Table.SelectRows(#"Linhas Filtradas", each [TPRDPR] = "PD"),
#"Colunas Removidas" = Table.RemoveColumns(#"Linhas Filtradas1",{"MOEDPR", "CLIDPR", "PTEDPR", "MODDPR", "EMBDPR", "GFMDPR", "QESDPR", "DSFDPR", "DSVDPR", "QBBDPR", "BNSDPR", "IVADPR", "DTFDPR", "RGADPR", "TPDDPR", "DUADPR", "MTPDPR", "ZZ6"}),
#"Linhas Ordenadas" = Table.Buffer(Table.Sort(#"Colunas Removidas",{{"DTPDPR", Order.Ascending}})),
GroupLast = Table.Group
(
#"Linhas Ordenadas",
{"SOCDPR", "TPRDPR", "ARTDPR"},
{
{"LastRow DTPDPR", each List.Last([DTPDPR])},
{"LastRow PBCDPR", each List.Last([PBCDPR])},
{"LastRow PDADPR", each List.Last([PDADPR])}})
in
GroupLastThank you so much
thank you for the answer. Thats it, but i had a filter in the article codes.
Now with all of the article codes, i want exactly the some as before. How do i do it?
thank you
let
Origem = Odbc.DataSource("dsn=inout.swapfilio", [HierarchicalNavigation=true]),
B606D19C_Database = Origem{[Name="B606D19C",Kind="Database"]}[Data],
SWAPFILIO_Schema = B606D19C_Database{[Name="SWAPFILIO",Kind="Schema"]}[Data],
GEFPR_Table = SWAPFILIO_Schema{[Name="GEFPR",Kind="Table"]}[Data],
#"Linhas Filtradas" = Table.SelectRows(GEFPR_Table, each [SOCDPR] = 1),
#"Linhas Filtradas1" = Table.SelectRows(#"Linhas Filtradas", each [TPRDPR] = "PD"),
#"Colunas Removidas" = Table.RemoveColumns(#"Linhas Filtradas1",{"MOEDPR", "CLIDPR", "PTEDPR", "MODDPR", "EMBDPR", "GFMDPR", "QESDPR", "DSFDPR", "DSVDPR", "QBBDPR", "BNSDPR", "IVADPR", "DTFDPR", "RGADPR", "TPDDPR", "DUADPR", "MTPDPR", "ZZ6"})
in
#"Colunas Removidas"
as you can see all the transformation i made are in the code i send, and there is no sorting
- Jimmy8016 years agoCommunity Champion
Hello hugoscp
then let's try this code
let Origem = Odbc.DataSource("dsn=inout.swapfilio", [HierarchicalNavigation=true]), B606D19C_Database = Origem{[Name="B606D19C",Kind="Database"]}[Data], SWAPFILIO_Schema = B606D19C_Database{[Name="SWAPFILIO",Kind="Schema"]}[Data], GEFPR_Table = SWAPFILIO_Schema{[Name="GEFPR",Kind="Table"]}[Data], #"Linhas Filtradas" = Table.SelectRows(GEFPR_Table, each [SOCDPR] = 1), #"Linhas Filtradas1" = Table.SelectRows(#"Linhas Filtradas", each [TPRDPR] = "PD"), #"Colunas Removidas" = Table.Buffer(Table.RemoveColumns(#"Linhas Filtradas1",{"MOEDPR", "CLIDPR", "PTEDPR", "MODDPR", "EMBDPR", "GFMDPR", "QESDPR", "DSFDPR", "DSVDPR", "QBBDPR", "BNSDPR", "IVADPR", "DTFDPR", "RGADPR", "TPDDPR", "DUADPR", "MTPDPR", "ZZ6"})), GroupLast = Table.Group ( #"Colunas Removidas", {"SOCDPR", "TPRDPR", "ARTDPR"}, { {"LastRow DTPDPR", each List.Last([DTPDPR])}, {"LastRow PBCDPR", each List.Last([PBCDPR])}, {"LastRow PDADPR", each List.Last([PDADPR])}}) in GroupLastIf this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy