Reduce DataSource to view (whatever is visible)

Hi, I am new to Grist and here’s my usecase:

I imported a sheet with let’s say: X-rows and Y-columns.

Now, I applied some filters in the data source which reduced the table size to let’s say: X-n rows.
I want to use this as a new data source with those applied filters and not the actual with X rows.
But, when I create a new table to get the count of a column over that new data source. I still get counts from the original data source.

One way would be to manually delete rows, which is very inconvenient if rows are in hundreds.
Another way would be to delete the data, not in the view, But not sure how to see the data(rows) excluded in from the current view.

Can we do this in any other way easily?

Hello,

If you want to delete the unused data, the most simple way would be to add a formula column which would contain the conditions you defined in your filters: that way, you could “reverse-filter” your view, and delete the rows. For example, in this table, you might filter the data where “> 20” is false.

If you’d better keep the unused data in the original table, you might use lookupRecords in your formula, to count only the records matching your conditions; and if you have conditions more complicated than equalities, you might use Python’s list comprehensions, as described here.