Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
MK_QSL
MVP
MVP

Find out Total Time Taken by each Project

1) NEED SOLUTION IN SCRIPT ONLY

2) TOTAL TIME Taken by Each Sub_Project also needed in Minutes


I need to find out Total Time Taken by each project..... i.e. X and Y

ProjectSub_ProjectProjectIDStartTimeEndTime
XX.A100101/07/2014 10:00:0002/07/2014 00:00:00
XX.A100202/07/2014 00:00:0003/07/2014 00:00:00
XX.B100302/07/2014 11:00:0002/07/2014 14:00:00
XX.A100403/07/2014 00:00:0003/07/2014 22:00:00
XX.C100503/07/2014 21:00:0003/07/2014 23:30:00
YY.B100605/07/2014 14:00:0006/07/2014 00:00:00
YY.A100705/07/2014 22:00:0006/07/2014 00:00:00
YY.A100806/07/2014 00:00:0007/07/2014 00:00:00
YY.B100906/07/2014 00:00:0007/07/2014 00:00:00
YY.A101007/07/2014 00:00:0008/07/2014 00:00:00
YY.B101107/07/2014 00:00:0008/07/2014 00:00:00
YY.A101208/07/2014 00:00:0009/07/2014 00:00:00
YY.B101308/07/2014 00:00:0008/07/2014 16:00:00
YY.A101409/07/2014 00:00:0010/07/2014 00:00:00
YY.C101509/07/2014 14:00:0009/07/2014 16:00:00
YY.A101610/07/2014 00:00:0010/07/2014 10:00:00

Also, to be noted, that any Sub_Projects falling in same time should not be calculated twice.

i.e.

Time taken by 1003 is already covered in 1002 so would not be counted...

Time taken by 1005 is actually 150 min but due to 60 mins already covered in 1004, will be counted as 90 min

Time taken by 1008 is completely matching with 1009, so only one of them would be counted , same with 1010 and 1011

1013 is covered in 1012, so will give 0 time

and so on...

8 Replies
maxgro
MVP
MVP

my attempt (hope to understand the question)

the idea is to generate every minute with iterno and then count distinct

martynlloyd
Partner - Creator III
Partner - Creator III

Hi,

SubProject:

LOAD
Project,
Sub_Project,
ProjectID,
Interval(EndTime-StartTime, 'mm') as Duration_SP
from ... ;

Project:
LOAD
Project,
Sum(Duration_SP) as Duration
Resident SubProject
Group By Project;

ML.

martynlloyd
Partner - Creator III
Partner - Creator III

Oops. Sorry, should be Interval#

And, of course, you will need to convert the duration back to a time to display (1=24hrs, 0.25=6hrs, etc), using Interval or Time, and your chosen format.

PradeepReddy
Specialist II
Specialist II

Hi Manish,

Please find the attached application, it might be helpful.

Regards,

Pradeep

rbecher
MVP
MVP

Hi Manish,

if you do not have gaps in between the time span the project duration would be:

LOAD

Project,

timestamp(Min(StartTime)) as StartTimePrj,

timestamp(Max(EndTime)) as EndTimePrj,

Interval(Max(EndTime) - Min(StartTime)) as Duration

Resident Data

Group By Project;

- Ralf

Data & AI Engineer at Orionbelt.ai - a GenAI Semantic Layer Venture, Inventor of Astrato Engine
jagan
Partner - Champion III
Partner - Champion III

Hi Manish,

Try like this

ProjectDetails:

LOAD

*

FROM DataSource;

ProjectDuration:

LOAD 

Project,  

Interval(Max(EndTime) - Min(StartTime), 'D') as DaysTaken

Resident ProjectDetails

Group By Project;

Regards,

Jagan.

martynlloyd
Partner - Creator III
Partner - Creator III

Hi Manish,

I believe this will solve your problem?

Community.JPG.jpg

SubProject

LOAD Project,
    
Sub_Project,
    
ProjectID,
    
StartTime,
    
EndTime,
Interval(EndTime-StartTime, 'mm') as Duration_SP
FROM
[..\Community.xlsx]
(
ooxml, embedded labels, table is Sheet1);

Project:
LOAD
Project,
Min(StartTime),
Max(EndTime),
Interval(Max(EndTime)-Min(StartTime))
Resident SubProject
Group By Project;

Regards..

MK_QSL
MVP
MVP
Author

Thanks for your reply.. .I am testing all replies...