3 Replies Latest reply on Jun 14, 2018 11:50 PM by Mavis Liu

    Getting the last 10 entries of each item

    rajat jain

      I have a worksheet where many units which are in rows have many alarms on different dates and in columns i have timestamp to track it.

      Each unit has a different amount of alarms and that too spread over different years,


      I want to get the last 10 alarms of each unit serial number such that it becomes a x by 10 matrix where x is the number of units.

        • 1. Re: Getting the last 10 entries of each item
          Mavis Liu

          Hi Rajat,


          Create your view by bringing in unit, then a timestamp into columns. I have attached a sample workbook using the superstore data.


          With my example, I want to see the latest 10 product IDs for each market:





          I double click into the blank area in rows and put in last(). Right click on this field and turn it into discrete:





          Move it so that it's after your first column (in your case it should be unit):


          Right click on last() and select edit table calculation, then tick on order date and product ID, but remove market:




          Then control click and drag last() into the filters shelf, (this should make a copy). Then right click on last() in the filters shelf to convert it to continuous:




          Then change the change to 0-9 to get the last 10 values.


          You should see something like this:





          Please see the attached workbook for more information.





          • 2. Re: Getting the last 10 entries of each item
            rajat jain

            Hi Mavis,

            Thanks for the help,

            I tried doing that with tableau but it didn't work out as planned. I gave the unit srl nbr & timestamp in the rows and created a last function in the rows column however it didn't turn out as on the screen.

            I tried creating a new field using alteryx and then with tableau i was able to achieve it though it was a time consuming exercise.

            Can you please explain why we chose discrete and then continous in the filters so i can get to know how to work with that?

            • 3. Re: Getting the last 10 entries of each item
              Mavis Liu

              Hi Rajat,

              The only reason why I used continuous in the filter is because you can create a range which makes it easier to filter in this case.

              So rather than a discrete field where I'll have to check on 0, 1, 2, 3, 4 etc... like this:




              Whereas with a continuous, I can just set the max value: