Search code examples
google-sheetspivot-table

Google Sheets pivot - remove empty rows


I have a transaction table and I need to show open balances for it.

Transactions

Pivot

I didn't find how to hide empty rows. I want to show just GREEN rows. I tried to use filter but it doesn't work

Test sheet


Solution

  • try:

    =ARRAYFORMULA({QUERY(REGEXREPLACE(""&QUERY(A1:D, 
     "select A,B,sum(D) where A is not null group by A,B pivot C"), 
     "^0$", ), 
     "where Col3 is not null or Col4 is not null");
     {"Grand Total", "", INDEX(QUERY(A1:D, 
     "select sum(D) where A is not null pivot C"), 2)}})
    

    enter image description here