let
Source = Excel.CurrentWorkbook(){[Name="Base"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date mouvement", type date}, {" Type", type text}, {" Categorie depense", type text}, {" Type depense", type text}, {" Tiers", type text}, {" No tiers", type text}, {" Tache", type text}, {" Code secteur", Int64.Type}, {" Libelle secteur", type text}, {" Projet", type text}, {" Piece", type any}, {" Libelle depense", type text}, {" Quantite", type any}, {" Cout unitaire", Int64.Type}, {" Montant", Int64.Type}, {" A refacturer (O/N)", type text}, {" Client", type text}, {" Prenom du responsable", type any}, {" Nom du responsable", type any}, {" No BT", type any}, {" Compte mouvemente", type any}, {" Tache libelle", type text}}),
#"Removed Columns" = Table.RemoveColumns(#"Changed Type",{" Type", " Categorie depense", " A refacturer (O/N)", " Client", " Prenom du responsable", " Nom du responsable", " No BT", " Compte mouvemente", " Tache libelle", " Cout unitaire", " Quantite", " Libelle secteur", " Piece"}),
#"Split Column by Delimiter" = Table.SplitColumn(#"Removed Columns", " Libelle depense", Splitter.SplitTextByEachDelimiter({" "}, QuoteStyle.Csv, true), {" Libelle depense.1", " Libelle depense.2"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{" Libelle depense.1", type text}, {" Libelle depense.2", type text}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type1",{{" Libelle depense.2", "immatriculation"}}),
#"Removed Columns1" = Table.RemoveColumns(#"Renamed Columns",{" Libelle depense.1", " Code secteur", " Type depense", " Tiers", " No tiers"}),
#"Added Custom" = Table.AddColumn(#"Removed Columns1", "titre", each if [#" Montant"] <0 then "remboursement" else "paiement"),
#"Removed Columns2" = Table.RemoveColumns(#"Added Custom",{"Date mouvement", " Tache"}),
#"Pivoted Column" = Table.Pivot(#"Removed Columns2", List.Distinct(#"Removed Columns2"[titre]), "titre", " Montant", List.Sum)
in
#"Pivoted Column"