4 Replies Latest reply: Mar 1, 2018 3:39 PM by CARL CIMINO RSS

    Prior YTD

    CARL CIMINO

      Hello, Trying to add some flags to my calendar and am having trouble getting the PYTD flag working.  The script below is what I have but it returns all N.  Any suggestions?  Thanks in advance.

       

      CommonCalendar:

      Load

        ACCOUNTING_YEAR,

           left(ACCOUNTING_QUARTER,2) as ACCOUNTING_QUARTER,

           ACCOUNTING_MONTH,

           MONTH_NUMBER,

           DAY_OF_WEEK,

           ACCOUNTING_DATE,

           ACCOUNTING_MONTH_YEAR,

           ACCOUNTING_DATE as Date,

           if(ACCOUNTING_YEAR=year(Today()),'Y','N') as CY_FLAG,

           if(ACCOUNTING_YEAR=(year(Today())-1),'Y','N') as PY_FLAG,

           if(MONTH_NUMBER=month(Today()),'Y','N') as CM_FLAG,

           if(ACCOUNTING_DATE>Today(),'Y','N') as FUTURE_FLAG,

           if(ACCOUNTING_DATE<=Today() and ACCOUNTING_YEAR=year(Today()),'Y','N') as YTD_FLAG,

        if((ACCOUNTING_YEAR=year(Today()-1) and ACCOUNTING_DATE<=addmonths(today(),-12)),'Y','N') as PYTD_FLAG

      FROM [lib://Daily_Quote_QVDs/AcctCal.qvd](qvd);