let
Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
ColName= Table.ColumnNames(Source),
Date_type = Table.TransformColumnTypes(Source,{{ColName{1}, type date}}),
#"Grouped Rows" = Table.Group(Date_type, ColName{0}, {{"Count", each Table.Sort(Table.SelectColumns(Table.AddColumn(_, "Merged", each Date.ToText(Record.Field(_,ColName{1}),[Format="dd-MM-yyyy"]) & "@" & Text.From(Record.Field(_,ColName{3}))),"Merged"), {{"Merged", Order.Descending}})}}),
#"Expanded Count" = Table.Sort(Table.ExpandTableColumn(#"Grouped Rows", "Count", {"Merged"}, {"Merged"}),{{"Merged", Order.Descending}}),
#"Split by Delimiter" = Table.SplitColumn(#"Expanded Count", "Merged", Splitter.SplitTextByDelimiter("@", QuoteStyle.Csv), List.Transform({1,3}, each ColName{_})),
#"Changed Type" = Table.TransformColumns(Table.TransformColumnTypes(#"Split by Delimiter",{{ColName{3}, Int64.Type}, { ColName{1}, type date}}), {{ ColName{1}, each Date.ToText(_, [Format="dd-MMM" , Culture="en-US"] )}}),
#"Changed Name" = Table.RenameColumns(Table.ExpandTableColumn(Table.SelectColumns(Table.Group(#"Changed Type", ColName{0}, {{"Count", each Table.RenameColumns(Table.SelectColumns(Table.AddColumn(Table.AddIndexColumn (_, "Index", 1,1), "Nom2", each if [Index] = 1 then Record.Field(_,ColName{0}) else null), {"Nom2", ColName{1}, ColName{3}}), {"Nom2", ColName{0}})}}), "Count"), "Count" , List.Transform ({0,1,3}, each ColName{_})),{{ColName{3}, "Sum of Nombre"}}),
Total = Table.InsertRows(#"Changed Name", Table.RowCount(Source),{Record.FromList({"Grand Total", null, List.Sum(#"Changed Name"[Sum of Nombre])} , Table.ColumnNames(#"Changed Name"))})
in
Total