I have a query that calculates an average of rows. The average value of a single row consists of the values that are not null/empty. Well this works. What I want now is to only count the row if its's average is bigger than a certain number. Now it's using all the rows. How can I get this done?
id | p_cijfer | b_cijfer | c_cijfer | c_id
----------------------------------------------
1  | 4        | 4        |    0     |   3   average = 4
----------------------------------------------
2  | 8        | 6        |    6     |   3   average = 6.7
----------------------------------------------
3  | 10       | 6        |    8     |   3   average = 8
----------------------------------------------
1  | 4        | 4        |    0     |   1   average = 4
----------------------------------------------
Now I only want to count the avarage of row with an higher average then 6. Wich will result in only counting record 2 and 3. Output must than be the average of id's 2 & 3, which average = (6.7+8)/2=7.5
select 
AVG(((reviews.prijs_cijfer+
 reviews.planning_cijfer+
 reviews.betrouwbaarheid_cijfer +
 reviews.communicatie_cijfer +
 reviews.kennis_cijfer +
 reviews.innovatie_cijfer
) /
nullif(
  case when prijs_cijfer=0 then 0 else 1 end +
  case when planning_cijfer=0 then 0 else 1 end +
  case when betrouwbaarheid_cijfer=0 then 0 else 1 end +
  case when communicatie_cijfer=0 then 0 else 1 end +
  case when kennis_cijfer=0 then 0 else 1 end +
  case when innovatie_cijfer=0 then 0 else 1 end , 0)))
from reviews