Sorry, I missed that part of your original message when I got engrossed in answering the first part.
How redefine start and end of the periods?
>If you follow my suggestion, you wouldn't have embedded IIF() in the first place.
>
>>Hi Sergey. Thanks for the attention.
>>
>>You see the old snippet below, commented out?
>>So, if ET.Date was between the curr period start and end dates it was summed.
>>Similarly, if it fell between the prev period start and end dates it was summed.
>>
>>However, there might not be start curr period date, or end prev period date so, respectively, the ET.Date would need to be between the end prev period and end curr period, or start prev period and start curr period.
>>
>>Whether or not my logic is flawed here (:-), I amn experimenting to get mself out of an anomolie that's not worth (or really possible easily) to explain here, and I mainly want to know where the niggling error is. That's why I've elaborately laid out the code, to saee what args go with what funcs more easily.
>>
>>Cheers
>>
>>>Hi Terry,
>>>
>>>Your SQL doesn't match what you are saying you're trying to do. Can you clarify your intentions?
>>>Anyway, you should redefine begining and end of each period instead of complication query itself.
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.