@farsami,
There is a parameter in your application where you can set the limit of the maximum number of records to handle within one request when going through the SharePoint connector:

The default value is 500. You can increase it up to 2000 max.
So even if you set it to 2000 and use the LastN function to retreive (let's say) the last 100 items, it will retreive items 1900 to 2000. And if you put your whole datasource as the main datasource for a DataTable control, you will see only the first 2000 records and it's only if you scroll down to the 2000th items that the connector will retreive the next items by blocks of 100 items each.
If you want to retreive the latest 100 items from your 5000 list items, you have 2 solutions:
- The easiest one is to sort your datasource on the modified date in descending order and pick the first 100 items
- The hardest way is to collect all 5000 items in a collection through a loop that will retreive the items by blocks of 500 items
So I really suggest you the first option, which should look like this:
FirstN(Sort(<yourdatasource>,Modified,Descending),100)
I hope this helps your case...
Emmanuel