Bonjour,
Voici une solution pour ajouter des sous-totaux avec QUERY :
=QUERY(VSTACK(QUERY({{A1\B1\D1\E1};query($A$2:$E;"select A, B, sum(D), sum(E) where A is not null group by B, A label sum(D) '', sum(E) '' " )}; "SELECT Col1, Col2, Col3, Col4 WHERE Col1 IS NOT NULL");QUERY(QUERY(query(query({filter(ArrayFormula({A1:A & " Total"});A1:A<>"")\filter(ArrayFormula(B1:E);A1:A<>"")};"select Col1, Col2, Col4, Col5");"select Col1, Col2, sum(Col3), sum(Col4) where Col1 is not null group by Col2, Col1 label sum(Col3) '', sum(Col4) '' " ); "SELECT Col1, Col2, Col3, Col4 WHERE Col1 IS NOT NULL");"SELECT Col1, ' ', SUM(Col3), sum(Col4) WHERE Col1 IS NOT NULL GROUP BY Col1 LABEL SUM(Col3)'', sum(Col4) '', ' ' '' " ));"select * where Col2 is not null and Col3 is not null ORDER BY Col1")
https://docs.google.com/spreadsheets/d/1CG4AfqdvldY8UfkF5JaoDJiQArgaib3AbeVeqwXAL1M/edit?usp=sharing
Cordialement,
Fil.