7 Replies Latest reply: Jan 12, 2018 6:55 AM by Gopal Madireddy RSS

    Hey Guys Can some one help or give idea about sorting Age Bucket in Character

    Gopal Madireddy

       

      Age Bucket is as string data type.

      Question :

       

      The business wants to sort by as below

      0

      1

      2 - 5

      16 - 29

      30 - 44

      45 - 60

      61 or more

      How can I achieve this, please any help appreciated.

      Dimension ( AgeBucket in Days) :

       

      = if( Aggr(FirstSortedValue(  {< CATEGORY= {'OPEN'}, DATEOUT_SELECT={'$(vQOutStandingDate)'} >}  QUEUEAGE,  -QUEUEAGE),WORKFLOWRTNGKEY ) = 0 , '0',
      if(Aggr(FirstSortedValue(  {< CATEGORY= {'OPEN'}, DATEOUT_SELECT={'$(vQOutStandingDate)'}  >} QUEUEAGE,  -QUEUEAGE),WORKFLOWRTNGKEY ) = 1, '1',
      if(Aggr(FirstSortedValue(  {< CATEGORY= {'OPEN'}, DATEOUT_SELECT={'$(vQOutStandingDate)'} >}  QUEUEAGE,  -QUEUEAGE),WORKFLOWRTNGKEY ) >=2
          AND Aggr(FirstSortedValue(  {< CATEGORY= {'OPEN'}, DATEOUT_SELECT={'$(vQOutStandingDate)'} >}  QUEUEAGE,  -QUEUEAGE),WORKFLOWRTNGKEY ) <=5, '2 - 5',
      if(Aggr(FirstSortedValue(  {< CATEGORY= {'OPEN'}, DATEOUT_SELECT={'$(vQOutStandingDate)'}  >} QUEUEAGE,  -QUEUEAGE),WORKFLOWRTNGKEY ) >=6
          AND Aggr(FirstSortedValue(  {< CATEGORY= {'OPEN'}, DATEOUT_SELECT={'$(vQOutStandingDate)'} >}  QUEUEAGE,  -QUEUEAGE),WORKFLOWRTNGKEY ) <=15, '6 - 15', 
      if(Aggr(FirstSortedValue(  {< CATEGORY= {'OPEN'}, DATEOUT_SELECT={'$(vQOutStandingDate)'} >}  QUEUEAGE,  -QUEUEAGE),WORKFLOWRTNGKEY ) >=16
          AND Aggr(FirstSortedValue(  {< CATEGORY= {'OPEN'}, DATEOUT_SELECT={'$(vQOutStandingDate)'} >}  QUEUEAGE,  -QUEUEAGE),WORKFLOWRTNGKEY ) <=29, '16 - 29',  
      if(Aggr(FirstSortedValue(  {< CATEGORY= {'OPEN'}, DATEOUT_SELECT={'$(vQOutStandingDate)'} >}  QUEUEAGE,  -QUEUEAGE),WORKFLOWRTNGKEY ) >=30
          AND Aggr(FirstSortedValue(  {< CATEGORY= {'OPEN'}, DATEOUT_SELECT={'$(vQOutStandingDate)'} >}  QUEUEAGE,  -QUEUEAGE),WORKFLOWRTNGKEY ) <=44, '30 - 44',           
      if(Aggr(FirstSortedValue(  {< CATEGORY= {'OPEN'}, DATEOUT_SELECT={'$(vQOutStandingDate)'}  >} QUEUEAGE,  -QUEUEAGE),WORKFLOWRTNGKEY ) >=45
          AND Aggr(FirstSortedValue(  {< CATEGORY= {'OPEN'}, DATEOUT_SELECT={'$(vQOutStandingDate)'} >}  QUEUEAGE,  -QUEUEAGE),WORKFLOWRTNGKEY ) <=60, '45 - 60',
      if(Aggr(FirstSortedValue(  {< CATEGORY= {'OPEN'}, DATEOUT_SELECT={'$(vQOutStandingDate)'}  > !@@@} QUEUEAGE,  -QUEUEAGE),WORKFLOWRTNGKEY ) >=60,'61 or more'
      ))))))))   

       

      Expression : OpenQueueAgeInBuckets

      =Count(DISTINCT {< CATEGORY= {'OPEN'}, DATEOUT_SELECT={'1/1/1964'} >} WORKFLOWRTNGKEY)

       

      Question :

       

      The business wants to sort by as below

      0

      1

      2 - 5

      16 - 29

      30 - 44

      45 - 60

      61 or more

      How can I achieve this, please any help appreciated.