let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
cols = {{"CODE JOURNAL", "DATE", "COMPTE", "INTITULE", "PIECE1"}, {"PIECE2", "DEBIT", "CREDIT", "COMPTE AUX"}, Table.ColumnNames(Source)},
#"Filled down" = Table.SelectRows(Table.FillDown(Source, {cols{2}{2}}), each Record.Field(_, cols{2}{2}) <> null),
#"Grouped Rows" = Table.Combine(Table.Group(#"Filled down", cols{2}{2},
{{"x", each
[ count = Table.RowCount(_),
a = {"ENC"},
b = {Date.From (Table.Column(_, cols{2}{0}){0})},
c = {"411000", "627510", "511100"},
d = {"Encaissement Paypal"},
e = {Date.From(Table.Column(_, cols{2}{1}){1})},
f = {null},
g = Table.Column(_, cols{2}{4}) ,
h = {null} & List.Transform(List.Skip(g), Number.Abs),
i = {List.First(g), null, null},
j = {"CB"},
tbl = Table.FirstN(Table.FillDown(Table.FromColumns({a,b,c,d,e,f,h,i,j}, cols{0} & cols{1}), cols{0}), count)
] [tbl]
}})[x])
in
#"Grouped Rows"