Home > database >  Google Sheet Query SUM exclude all SUM equal zero
Google Sheet Query SUM exclude all SUM equal zero

Time:10-04

cracking brain for this.

I have a very simple query with group and sum, and I want to exclude all sum results that are zero.

My actual query is:

=query(A:J;"SELECT D, SUM(I), SUM(H) WHERE C<>'S' GROUP BY D ORDER BY D DESC")

So.. I know I cant do something like this:

=query(A:J;"SELECT D, SUM(I), SUM(H) WHERE C<>'S' AND SUM(I)>0 GROUP BY D ORDER BY D DESC")

I'm trying with query inside filter, query inside query, but I can't figure out how to solve it.

CodePudding user response:

try:

=QUERY(QUERY(A:J; 
 "select D,sum(I),sum(H) 
  where C<>'S' 
  group by D 
  order by D desc"); 
 "where Col2>0"; 1)
  • Related