Google Sheet查询SUM排除IF不为空

Google Sheet Query SUM exclude IF is not blank

在选项卡 "Invoice WholeSale" 的单元格 "B3" 中,我需要一个查询来对选项卡求和:

但按 WholeSale 列分组并忽略此列中没有文本的行。

这里是my Google sheet

例如,我希望从选项卡中获得:
"Stock Warehouse Moves"

以及来自选项卡
"Stock Shop Moves"

我试过了,但没用:

=query('Stock Warehouse Moves'!A3:I,"select H, sum(B) where (H is not null) group by H"{'Stock Shop Moves'!A3:I,"select H, sum(B) where (H is not null) group by H"})

还有这个,但没有正确显示数据:

=query('Stock Shop Moves'!A3:I,"select H, sum(B) where (H is not null) group by H")

我希望下一个按 WholeSale 分组:

这样试试:

=QUERY({'Stock Warehouse Moves'!A3:H; 'Stock Shop Moves'!A3:H},
 "select Col1,count(Col8),Col8 
  where Col8 is not null 
  group by Col1,Col8 
  label count(Col8)''", 0)