I have a sample data here with Start and End Dates. In the Qlik app, I would have a variable input for: EmployeeId, Date From and Date To. I need help in counting the days that the employee is in a location at a given time.
In most use-cases it's not possible to calculate it in the UI just with more or less advanced set analysis else it would also need to use aggr-functions and maybe even nested ones. That's not only quite complex else usually rather slowly, too.
The most common approach is therefore to resolve the from-to dates within the script to a real data. The backgrounds for it could you find here: IntervalMatch.
The general approach of resolving numeric intervals with an intervalmatch or alternative with a while-loop worked usually very well and it's quite easy to implement. To solve such a task within the UI is much more complicated and therefore you shouldn't go this way unless you had ensured that intervalmatch didn't provide the needed results.
Therefore my suggestion just to try it. Very useful is often to do it at first in a dummy-application with a reduced dataset on records and fields to comprehend the logic and after that you could transfer the knowledge into your target-application.