Issue in days calculation while plotting Gantt Chart
I have an issue in calculating time taken for activities which is used in plotting a gannt chart.
In Qlik app, I am calculating activity wise (field - activity) time taken (fields - start_date, end_date). For this, I am subtracting activity wise max(end_date) - min(start_date).
But, there is an issue. Certain activities are repeated after certain time. So, the system is calculating time taken for an activity based on max and min date, which is wrong in few scenarios. For example. If an activity1 is done between 18-08-2016 and 25-08-2016, and activity2 is done between 25-8-2016 to 30-08-2016 and activity3 is done 30-8-16 - 2-9-16. Again activity1 is done from 02-9-16 to 8-9-16. In this scenario, for activity1, the system is calculating time taken as 21 days (18-8-16 to 08-9-16), while it should be ; 7 days+ 6 days = 13 days.
Please help me in calculating the time taken properly.