Bonjour,
Une proposition à étudier.
Cdlt.
let
Source = Excel.CurrentWorkbook(){[Name="Tableau1"]}[Content],
#"Type modifié" = Table.TransformColumnTypes(Source,{{"SECTEUR", type text}, {"DATE", type date}, {"MONTANT", Int64.Type}}),
#"Sorted Rows" = Table.Sort(#"Type modifié",{{"DATE", Order.Ascending}}),
Added_Index = Table.AddIndexColumn(#"Sorted Rows", "Index", 0, 1),
#"Added Custom" = Table.AddColumn(Added_Index, "Custom", each try Added_Index[MONTANT]{[Index]-1} otherwise 0),
#"Renamed Columns" = Table.RenameColumns(#"Added Custom",{{"MONTANT", "MONTANT J"}, {"Custom", "MONTANT J-1"}}),
#"Removed Columns" = Table.RemoveColumns(#"Renamed Columns",{"Index"})
in
#"Removed Columns"