3 Replies Latest reply: Dec 22, 2016 1:14 PM by Manish Kachhia RSS

    Looping every 4 rows in column

    James Eckstein

      I have a column of data where the first first and second rows are dimension values and the third and fourth row are metric values. This table has a bunch of rows stacked on top of each other


      I created this script




      Peek(@Value_u0,0,'rows') as [Age Group],

      Peek(@Value_u0,1,'rows') as [City],

      Peek(@Value_u0,2,'rows') as [Users],

      Peek(@Value_u0,3,'rows') as [New Users]

      Resident rows





      Peek(@Value_u0,4,'rows') as [Age Group],

      Peek(@Value_u0,5,'rows') as [City],

      Peek(@Value_u0,6,'rows') as [Users],

      Peek(@Value_u0,7,'rows') as [New Users]

      Resident rows




      and this is giving me the desired output. The issue is that i need to do this for an unknown amount of rows. (or the number of rows/4).


      I am having trouble putting together the syntax to loop over and over to give me the desired result.



      Let me know if you need more information.


      Thanks in advance!!