3 Replies Latest reply: May 7, 2013 11:06 AM by Eddy Sanchez RSS

    Dual lines as one?

      Hello,

       

      I am new  to Qlikview and have what is probably a basic question.  How can I join the lines (example data) into one?

       

      Year     Part     Quantity     Revenue

      2013     A          10               $100

      2012     A          12               $80

       

      I want the end result to look like something like...

       

      Part     Current Year QTY     Prior Year QTY     Current Rev     Prior Year Rev

      A          10                              12                         $100               $80

       

      I tried an 'IF' statement but could not get both value to show up unless I had the year field in my table...which I do not want.

       

      Any help would be great.

       

      Thanks,

       

      KMC

        • Re: Dual lines as one?
          Eddy Sanchez

          LET vCurrentYear = Year(Today());

           

           

          Table:

          LOAD Part, Quantity as [Current Year QTY], Revenue as [Current Rev]

          Inline [

          Year, Part, Quantity, Revenue

          2013,     A,          10,               $100

          2012,     A,          12,               $80

          ]

          Where Year = $(vCurrentYear);

           

           

          Left Join(Table)

          LOAD Part, Quantity as [Prior Year QTY], Revenue as [Prior Year Rev]

          Inline [

          Year, Part, Quantity, Revenue

          2013,     A,          10,               $100

          2012,     A,          12,               $80

          ]

          Where Year = $(vCurrentYear)-1;

            • Re: Dual lines as one?

              Eddy,

               

              Thanks but can I have a little more help?  I believe you are telling me to adjust the way in which I load the data....yes? 

              If my load script looks like this. now.... 

               

              SQL

              SELECT `Amount - USD`,
              `Amount - USD1`,
              `Invoice Year`,
              `Manufacturing Plant`,
              `Part Description1`,
              `Part Number`,

              What should the script look like if I want the stacked data (2013 and 2012 on different lines) to be combined into one line?

               

              Thanks,

               

              KMC