7 Replies Latest reply: Nov 23, 2011 5:32 AM by rohit gupta RSS

    Min(Variable)

      I clearly have so much to learn!!!

       

      I have a dataset which contains the field YearPeriod.

       

      This field has records as follows: 2010 01, 2010 02, 2010 03, 2010 04 etc.

       

      If I use YearPeriod as a dimension or expression, I get returns for the above.

       

      However, if I make the expression Min(YearPeriod) I get 201001 - note there is no embedded space - and so this does not match any value in YearPeriod.

       

      Why is this?

       

      How do I return 2010 01?

       

      Muchas Gracias

       

      Dave

       

      Message was edited by: davewright - typo

        • Min(Variable)

          Hi Dave,

           

          There are many ways to address this. I would do something like below:

           

          date#(text(replace(YearPeriod,' ','-')),'YYYY-MM') as YrPeriod

           

          Cheers,

          Shyam

            • Min(Variable)

              Hi Shyam,

               

              Thanks for your suggestion, I am most grateful.

               

              However, I'm not sure if it will do what I require.

               

              (Sometimes I'm not sure just how much detail to include when asking.)

               

              The point of Min(YearPeriod) equalling the minimum YearPeriod exactly, is that I want to use it to drive an indexing calculation.

               

              But as there are no data indicated by the YearPeriod 201001 (no space) then I get only errors for the calculation.

               

              If I understand what you have suggested, I will just end up with a Min(YearPeriod) equalling 2010-01, which still won't match any value in YearPeriod, won't I?

               

              I guess I could create a new Year-Period variable by including the "-", but I am reluctant to do so - mainly because I am not comfortable with messing too much with my imported tables.

               

              If you can shed any more light, I would be equally appreciative.

            • Min(Variable)
              rohit gupta

              hI DAve

              try this =replace(YearPeriod,'','-')

              may it helps you

              thanks

              rohit