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
Hello hugoscp
my code works just fine. I applied my logic to your new data example. And my output is the one expected
maybe you are sorting the table before?
If 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
i am not sorting. I dont know why some work and others dont