dense_rank max OVER 3 days? How do I get the MAX (or another aggregate function) for of a column of each row, OVER its 3 days worth of rows?

SQL example with expected output and db schema: http://sqlfiddle.com/#!17/24686/3

CREATE TABLE public.tbl (
  date    DATE       NOT NULL,
  someNum DECIMAL    NOT NULL,
  name    VARCHAR(6) NOT NULL,
  elem    VARCHAR(9) NOT NULL,
  PRIMARY KEY ("date", someNum, "name", elem)
);

INSERT INTO public.tbl ("date", someNum, "name", elem) VALUES
  ('2017-12-05', 50.5, '0hello', 'nice elem'),
  ('2017-12-05', 05.5, '1hello', 'nice elem'),
  ('2017-12-05', 55.5, '2hello', 'nice elem'),
  ('2017-12-09', 59.5, '3hello', 'nice elem'),
  ('2017-12-09', 60.5, '4hello', 'nice elem'),
  ('2017-12-10', 90.5, '5hello', 'nice elem'),
  ('2017-12-12', 10.5, '6hello', 'nice elem'),
  ('2017-12-15', 50.3, '7hello', 'nice elem'),
  ('2017-12-30', 70.5, '8hello', 'nice elem'),
  ('2018-01-01', 50.5, '9hello', 'nice elem'),
  ('2017-12-05', 05.5, '10ello', 'mean elem'),
  ('2017-12-05', 5505, '11ello', 'mean elem'),
  ('2017-12-05', 6045, '12ello', 'mean elem'),
  ('2017-12-03', 9045, '13ello', 'mean elem'),
  ('2017-12-04', 1345, '14ello', 'mean elem'),
  ('2017-10-02', 1111, '15ello', 'mean elem'),
  ('2017-10-03', 5555, '16ello', 'mean elem'),
  ('2017-10-04', 66.6, '16ello', 'mean elem');


Desired output,

-- MAX over 3 day period
-- date         somenum     name        elem            max_over_3days
-- 2017-10-02   1111        '15ello'    'mean elem'     5555
-- 2017-10-03   5555        '16ello'    'mean elem'     5555
-- 2017-10-04   66.6        '16ello'    'mean elem'     5555
-- 2017-12-03   9045        '13ello'    'mean elem'     9045
-- 2017-12-05   6045        '12ello'    'mean elem'     9045
-- 2017-12-04   1345        '14ello'    'mean elem'     9045
-- 2017-12-05   05.5        '10ello'    'mean elem'     9045
-- 2017-12-05   5505        '11ello'    'mean elem'     9045
-- 2017-12-05   50.5        '0hello'    'nice elem'     9045
-- 2017-12-05   55.5        '2hello'    'nice elem'     9045
-- 2017-12-05   05.5        '1hello'    'nice elem'     9045
-- 2017-12-09   60.5        '4hello'    'nice elem'     90.5
-- 2017-12-09   59.5        '3hello'    'nice elem'     90.5
-- 2017-12-10   90.5        '5hello'    'nice elem'     99.5
-- 2017-12-13   99.5        '6hello'    'nice elem'     99.5
-- 2017-12-15   50.3        '7hello'    'nice elem'     99.5
-- 2017-12-30   70.5        '8hello'    'nice elem'     70.5
-- 2018-01-01   50.5        '9hello'    'nice elem'     70.5

SELECT * FROM public.tbl
GROUP BY elem, "date", name, someNum
ORDER BY elem, "date";


PS: Also interested with how I can cover 3 work days rather than calendar days
Using CROSS JOIN LATERAL

The output is similar to your output, but please check again. Here's, I using lateral (as loop) to find the max value of someNume for the 3 surrounding days (it doesn't mention about performance).

SELECT tbl.date, tbl.somenum, tbl.name, tbl.elem, t2.max_somenum
FROM tbl
CROSS JOIN LATERAL (
  SELECT MAX(t2.somenum) AS max_somenum
  FROM tbl t2 
  WHERE t2.date &gt;= (tbl.date - interval '3 days') AND t2.date &lt;= (tbl.date + interval '3 days')
) t2
ORDER BY date;