8 Replies Latest reply: Jun 29, 2015 9:49 AM by L H RSS

    Show only a few years

      Hello everyone!

       

      years.png

       

      This are all the years from my data. Jaar is the Dutch word for year.

       

      This is in my script:

       

       

      LOAD Number,
      (
      JAAR+2000) as JAAR,
      FROM
      \source
      (
      qvd);

       

      My question is: Can I said in my data that I only want to see the max year, and 3 other. In this case: 2015, 2014, 2013 and 2012?

       

      Or is this impossible.

       

      I know I ask something like this in another post, but this is an better one.

       

      Thanks!

        • Re: Show only a few years
          Jonathan Penuliar

          Try Preceding Load:

           

          Load *

          Where JAAR >= '2012;'

          LOAD Number,
          (
          JAAR+2000) as JAAR,
          FROM
          \source
          (
          qvd);

          • Re: Show only a few years
            Gysbert Wassenaar

            If you don't want to load the data of earlier years you can use a where clause:


            LOAD Number,
            (
            JAAR+2000) as JAAR,
            FROM \source (qvd)

            WHERE JAAR >=12;


            If you do want to load the data, but want to filter it in the front end there are several ways. You could simply select the years you want to see. This is the easiest solution. You could create a bookmark for that selection so you can easily return to that selection.

            • Re: Show only a few years
              Joseph Simmons

              Hi Lieko

               

              You could add a simple where condition on the load, or create something a bit more dynamic based on your data.

              Something like the below should work.

               

              MaxYear:

              LOAD Distinct
              Max((
              JAAR+2000)) as JAAR,
              FROM
              \source
              (
              qvd);

               

              Let vMaxYear =Peek('JAAR')

              Drop table MaxYear;

               

               

              LOAD Number,
              (
              JAAR+2000) as JAAR,
              FROM
              \source
              (
              qvd)

              Where (JAAR+2000)  > $(vMaxYear-3);

               

               

              Hope that helps

              Joe

               

              • Re: Show only a few years
                Jose Maria Sanchez Herrero

                You can try something like this:

                 

                 

                Year_start = year(yearstart(AddMonths(today(), -36))); //-36 means the number of years from now in months 12x3=36

                Year_today = year(yearstart(AddMonths(today(), 0)));

                 

                Jaar:

                LOAD  Number,

                  (Jaar+ 2000) as Jaar

                FROM \source

                where (Number + 2000)>='$(Year_start)' and (Number + 2000)<='$(Year_today)';

                 

                Hope that helps

                • Re: Show only a few years
                  balkumar chandel

                  If you want to just show Latest 4 years in your list box .

                  Then just create a variable

                   

                  Var1=max({1}JAAR)-4

                   

                  then select list box and use expression in place of field name

                  in expression write

                   

                  =if(JAAR>=Var1,JAAR)

                   

                  it will show you four latest year.

                   

                  If this is not your requirement let me know .

                   

                  Thanks

                  BKC

                  • Re: Show only a few years

                    Thanks alll! The option of BKC is the easiest one for me. It was correct!