8 Replies Latest reply: Sep 7, 2012 8:56 AM by jagan mohan rao appala RSS

    Sort date in ascending order

    Uday Kumar

      Hi,

       

      I am using the below code in the Edit Script to get the quarter, half year and yearly data for the report.

       

        'Quarter' & Ceil(Month(MONTH_DATE)/3) & '(' & Year(MONTH_DATE) & ')' AS DATE_DIM.QuarterYear,

      'HalfYear' &
      Ceil(Month(MONTH_DATE)/6) & '(' & Year(MONTH_DATE) & ')' AS DATE_DIM.HalfYear,

      'Year' &
      Ceil(Month(MONTH_DATE)/12) & '(' & Year(MONTH_DATE) & ')' AS DATE_DIM.Year

       

      These date fields are not sorting in order, because of the text Quarter or HalfYear in the field.

      I have attached the image with this, please check the field that how the field is sorting.

      so how can we sort it in ascending order?

      the image shows the sorting as

      HalfYear1(2010), HalfYear1(2008),HalfYear1(2007),...

      But i want the sort order like

      HalfYear1(2006),HalfYear2(2006),HalfYear3(2006),HalfYear4(2006),HalfYear1(2007),......