Dynamic Count of items +/- 15% per row value
Not sure exactly what you want, but I imagine it's something like this. Here we use a INNER JOIN and check the right table for the range.

-- sample data
WITH t(x) AS (SELECT generate_series(1,10))

SELECT t1.x,
  t1.x*0.85 AS lower, -- just so you can see the lower
  t1.x*1.15 AS upper, -- just so you can see the upper
  count(*)
FROM t AS t1
INNER JOIN t AS t2
  ON t2.x BETWEEN t1.x*0.85 AND t1.x*1.15  -- JOY
GROUP BY t1.x
ORDER BY t1.x;


Output,

 x  | lower | upper | count 
----+-------+-------+-------
  1 |  0.85 |  1.15 |     1
  2 |  1.70 |  2.30 |     1
  3 |  2.55 |  3.45 |     1
  4 |  3.40 |  4.60 |     1
  5 |  4.25 |  5.75 |     1
  6 |  5.10 |  6.90 |     1
  7 |  5.95 |  8.05 |     3
  8 |  6.80 |  9.20 |     3
  9 |  7.65 | 10.35 |     3
 10 |  8.50 | 11.50 |     2
(10 rows)