Its something similar too, but in queries we use IIF function
- IIF(Hour(<date>)MOD 24 >= 3, DateAdd("d",-1,<date>),<date>)
This bit of function first check the if the hour contained in <date> is over 3 or not, which means the time between 12AM to 3AM. If it is true, then use DateAdd to take one day back (taking Dec 01 back to Nov 30). Otherwise it remains as what it is.
Also, can you post your query of what you've done so far?