6 Replies Latest reply: Jun 13, 2016 10:48 AM by Richard Chilvers RSS

    If statement -> Loop

    Mark Graham

      Hi all,

       

      I'm using If statement to filter out the data into buckets.

       

      I was wondering whether the same can be achieved by Loop concept.

       

      Any help is highly appreciated.

       

       

      LOAD *,

      If(

      ([Fiscal Week]>=1 and [Fiscal Week]<=4), 1,

      If(

      ([Fiscal Week]>=5 and [Fiscal Week]<=8), 2,

      If(

      ([Fiscal Week]>=9 and [Fiscal Week]<=12), 3,

      If(

      ([Fiscal Week]>=13 and [Fiscal Week]<=16), 4,

      If(

      ([Fiscal Week]>=17 and [Fiscal Week]<=20), 5,

      If(

      ([Fiscal Week]>=21 and [Fiscal Week]<=24), 6,

      If(

      ([Fiscal Week]>=25 and [Fiscal Week]<=28), 7,

      If(

      ([Fiscal Week]>=29 and [Fiscal Week]<=32), 8,

      If(

      ([Fiscal Week]>=33 and [Fiscal Week]<=36), 9,

      If(

      ([Fiscal Week]>=37 and [Fiscal Week]<=40), 10,

      If(

      ([Fiscal Week]>=41 and [Fiscal Week]<=44), 11,

      If(

      ([Fiscal Week]>=48 and [Fiscal Week]<=52), 12)))))))))))) as [Fiscal Month];