5 Replies Latest reply: Dec 18, 2014 4:35 AM by govindaraj s RSS

    How to create Age range

      Hi all,

       

      I have project to analyze my member age with range.

      Can you guys help me on this.

       

      Example

       

      NameAge
      Soehoed14
      Saulina12
      Murni17
      Lina19
      Togu22
      Tan23
      Sunarti20
      Nyoman16
      Daswirman30
      Asnaria32
      Mrtha35
      Yen28
      Fatimah40
      Retno45
      Darwadi34
      Maemunah52
      Florentina55
      Andi65
      Halena43
      Susilowati36
      Elizabet24
      Isnaniek27
      Asliani18
      Darwati51
      Nurdin48
      Ambo41
      Lankoani36

       

      I want to create range :

      How many :

      <17 years

      17 - 25

      25 - 30

      30 - 40

      40 - 50

      > 50

       

      Thank you

      Henry

        • Re: How to create Age range
          Manish Kachhia

          Create below field in your script..

           

          If(Age <=17, '<17 Years',

            IF(Age >= 17 and Age < 25, '17 - 25',

            IF(Age >= 25 and Age < 30, '25 - 30',

            IF(Age >= 30 and Age < 40, '30 - 40',

            IF(Age >= 40 and Age < 50, '40 - 50',

            '50+'))))) as AgeRange

           

          Now create a chart

          Dimension

          AgeRange

           

          Expression

          COUNT(Distinct Name)

          • Re: How to create Age range
            Manish Kachhia

            If you dont want to create the same in script... use below as a calculated dimension and use the same expression provided above.

             

            =Aggr(If(Age <=17, '<17 Years',

              IF(Age >= 17 and Age < 25, '17 - 25',

              IF(Age >= 25 and Age < 30, '25 - 30',

              IF(Age >= 30 and Age < 40, '30 - 40',

              IF(Age >= 40 and Age < 50, '40 - 50',

              '50+'))))),Name)

            • Re: How to create Age range

              Manish's solution is good. You can also uses intervalmatch(), where you load inline the ranges

              For example:

              Employee_age:
              LOAD * INLINE [
              Name, Age
              John, 35
              Katy, 26
              William, 52
              Barbara, 46
              Erik, 18
              ]
              ;



              Age:
              LOAD *
              INLINE [
              MinAge, MaxAge
              0, 17
              18, 25
              26, 30
              31, 40
              41, 50
              51, 1000
              ]
              ;


              IntervalMatch (Age)
              Load
              MinAge as Min_Age, /*------Rename to avoid synthetic keys---------*/
              MaxAge as Max_Age
              Resident
              Age;

               

              Put the appropriate fields in a straight table for e.g. :

               

               

              I hope it helped!

               

              Best,

               

              T

              • Re: How to create Age range
                govindaraj s

                I think Class Function might you to achieve it..

                 

                =class(Age,5) ,it groups Age as class with difference of 5

                 

                 

                 

                Best Regards,

                 

                Govindaraj