With a good time dimension, this boils down to a complex join problem. To what extent can you modify the time dim? Can you add month end flag? (The month start flag is, of course, day of month = 1).
So you have two fields, begin date and end date, and ...
So you have two fields, begin date and end date, and ...