First, a quick introduction to table calculations, followed by the answer at the end.
The data source (e.g. database server) does the majority of Tableau's calculations, and the results are subsequently delivered to Tableau (i.e. the client) for presentation. Even when dealing with very huge data sets, this division of duties allows for good performance.
Table computations, on the other hand, work with the table of query results received from the server. They are carried out near the end of the pipeline's order of operations. That's why table calcs work with aggregated data, thus you'll need to ask for WINDOW SUM(SUM([Sales)) rather than WINDOW SUM([Sales)) ([Sales])
Before presenting the query results obtained from the data source to the user, you may utilise table calcs to do last passes of computations over them. You can do things like compute a running total or dynamically change the visualisation layout based on the query results. The computation is only one component of defining a table calc, therefore this freedom comes at a cost. You must also define how the calculation should be applied to the table of summary results, a process called as partitioning and addressing. A useful definition of partitioning and addressing may be found in the Tableau online documentation.
Table calculations, also known as vectors or windows, are applied to blocks of summary data at a time. Partitioning is how you tell Tableau how you want the summary query results broken up into panes so you can apply your table calc. The way you indicate the sequence in which you want to traverse those partitions is using addressing. Some table calcs, such as RUNNING SUM, require addressing, whereas others, such as WINDOW SUM, do not.
To truly comprehend table calculations, it is also beneficial to learn about the functions INDEX(), SIZE(), FIRST(), LAST(), WINDOW SUM(), LOOKUP(), and (eventually) PREVIOUS VALUE(). You'll be able to implement all of these functions utilising only two of them as the essential ones if you properly grasp them.
Finally, to answer your question in part:
To determine if you are at the last value of your division, use the boolean expression LAST() = 0. You may hide all the other values by using that formula as a filter. You'll need to make sure the partitioning and addressing are set up appropriately. You'd be retrieving a batch of data from your server, using it in client calculations, but just displaying a portion of it. Depending on which fields are on which shelves, this can be a bit brittle, but it can work.
If you can avoid requesting data exclusively for client-side calculations, it's usually more efficient to utilise a calculation that can be performed server-side, such as LOD calc. Table calcs, on the other hand, are a helpful tool if the data has already been fetched for another purpose or if the calculation requires table calc features, such as the ability to depend on the order of the values.
Unlock the Power of Data Visualization with Our Tableau Course.