Entries count by date is giving wrong results
Looks like StockUpdated has a time part that makes the query not count the values on 2016-12-31 with time other than 00:00.

Try a non inclusive comparison instead. StockUpdated &lt; '2017-01-01'