I see. You could do it with a combination of an in clause an an outer join. The in clause lists what you want to display (months, weeks, etc). The outer join shows the row even if the count is zero.
You need some mechanism to build up the logic for the in clause. You could use
JDBC or PL/SQL to do that. Either has loops.