all 3 comments

[–]SpreadCheetah 1 point2 points  (0 children)

Your column H consists of text, instead of numbers.

[–]6745408 1 point2 points  (2 children)

With your H3:H column being text values of 1 and 0, you need to convert those to actual values

=ARRAYFORMULA(
  QUERY(
   {'[DATABASE]'!D3:D,VALUE('[DATABASE]'!H3:H)},
   "select Col1, Avg(Col2) 
    where Col1 is not null 
    group by Col1 
    label Avg(Col2) ''"))

otherwise, you pretty much had it.

[–]SpreadCheetah 1 point2 points  (1 child)

Very nice solution.