Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum of Time

Dear All,

Please find the below images

Selected Few dates but the sum is showing wrong.

Capture1.PNG

Capture3.PNG

Capture2.PNG

Regards,

Keerthi KS

1 Solution

Accepted Solutions
rahulpawarb
Specialist III
Specialist III

Hello Keerthi,

Based on my understanding, for dimensions RegularizedStatus & EmployeeAttendanceLogDate there are two records with same value of LogInTime, RegInTime, LogOutTime & RegOutTime etc. (refer attached excel sheet).

As as workaround, I have used DISTINCT in aggregation function.

Hope this will be helpful.

Regards!

Rahul

View solution in original post

12 Replies
sarvesh
Creator III
Creator III

Hi..Keerthi,


You can try this, it will help you.


=Interval(Sum(SubField(duration_txt,' ',-1))) 

sushil353
Master II
Master II

what is the expected output ?

Not applicable
Author

39:37:00

rahulpawarb
Specialist III
Specialist III

Hello Keerthi,

Please refer below given expression:

=Interval(Sum(Num(EmpAttendenceLogTime)), 'hh:mm:ss')

Also review the attached sample application.

Hope this will be helpful.

Regards!

Rahul

Anil_Babu_Samineni

Just do =Time(Sum(EmpAttendenceLogTime))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Not applicable
Author

EmpAttendanceLogs:

LOAD

    Uniqueid as EmpAttedenceLogID,

    EmployeeUniqueId as EmpLogUniqueid,

    Date(Floor(Num(AttendenceDate))) as EmpAttendenceLogDate,

    AttendenceTime as EmpAttendenceLogTime,

    attendence as EmpAttendenceLogDateTime,

    IsRegularized

FROM

[..\10_data_sources\EmpAttendanceLogs.qvd]

(qvd);

Left Join (EmpAttendance)

Load

EmpLogUniqueid,

EmpAttendenceLogDate,

RegularizedStatus,

Date(Min(EmpAttendenceLogTime),'hh:mm:ss') as RegInTime,

Date(Max(EmpAttendenceLogTime),'hh:mm:ss') as RegOutTime

Resident EmpAttendance where IsRegularized=1

Group by EmpLogUniqueid,EmpAttendenceLogDate,RegularizedStatus;

Left Join (EmpAttendance)

Load

EmpLogUniqueid,

EmpAttendenceLogDate,

RegularizedStatus,

Date(Min(EmpAttendenceLogTime),'hh:mm:ss') as LogInTime,

Date(Max(EmpAttendenceLogTime),'hh:mm:ss') as LogOutTime

Resident EmpAttendance where IsRegularized=0

Group by EmpLogUniqueid,EmpAttendenceLogDate,RegularizedStatus;

My data model is something like this.

When i check for Sum with EmpAttendenceLogTime. It was showing correctly.

When i sum for RegInTime its showing double.


Please let me know if there is any mistake.

rahulpawarb
Specialist III
Specialist III

Hello Keerthi,

To further analyze this issue, could you please share the application with sample data? This will help us to provide your expected result.

Regards!

Rahul

Not applicable
Author

Hi Rahul,

Please find the attached application.

Regards,

Keerthi KS

rahulpawarb
Specialist III
Specialist III

Hello Keerthi,

Based on my understanding, for dimensions RegularizedStatus & EmployeeAttendanceLogDate there are two records with same value of LogInTime, RegInTime, LogOutTime & RegOutTime etc. (refer attached excel sheet).

As as workaround, I have used DISTINCT in aggregation function.

Hope this will be helpful.

Regards!

Rahul