I am trying to calculate sales for the previous quarter both this year and for last. I am using the following:
Previous qtr same year
if datepart("q",currentdate)=1 then
datepart("q",{INIDP.INVDAT})=4
and datepart("yyyy",{INIDP.INVDAT})=datepart("yyyy",dateadd("yyyy",-1,currentdate))
else...