Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculating Total time of positive and negative values

hi,

I am trying to calculate the total time for agent was started their shifts late. The column contains negative(-) values as well, could you please assist. my expression i used is

sum ( aggr(

fabs( SUM(StartShiftLate)/86400)

          , AgentName) )

 

STARTinSec
-28
-349
-66
-13
-35
-43
-6
-41
-1071
-1345
-60
-41
-25
-17
-22
-42
-20
0
-267
-153
-215
-1621
-355
-508
-30
-30
-33
-33
-33
-53
20
-32
-143
27000
-189
-246
-47
-265
-1674
-23
-415
-20
-38
-15
-15
-1409
-76
-11
-1
-373
-4
-18
12
-11
-8
-157
-12
2589
10
7
-87
-7006
8 Replies
arvind_patil
Partner - Specialist III
Partner - Specialist III

Hi Marvin,

Could you  explain more what desired output you require.

thanks,

Arvind Patil

Not applicable
Author

hi,

i need to get the sum of time start shift late, if the time have a minus then the person was early and positive is late. so the result would be sum of positive values.

tresesco
MVP
MVP

This?

sum ( aggr(

SUM({<StartShiftLate={">0"}>}StartShiftLate) /86400

          , AgentName) )

effinty2112
Master
Master

Hi Marvin,

Try:

Sum(if(STARTinSec>0,STARTinSec))


Cheers


Andrew

arvind_patil
Partner - Specialist III
Partner - Specialist III

Hi marvin,

Try to use below:

=aggr(sum({<Agentname={'SUm(STARTinSec)>0'}>}STARTinSec)/86400,Agentname)


Thanks,

Arvind Patil

avinashelite

Try like this

For Positive :

sum ( aggr(SUM({<STARTinSec={">0"}>}STARTinSec) /86400, AgentName) )

For Negative :

sum ( aggr(SUM({<STARTinSec={"<0"}>}STARTinSec) /86400, AgentName) )

Not applicable
Author

hi,

Thanks but its still not working yet , its not giving any results

Anil_Babu_Samineni

I think you have only one record which has 0. And you are using Fabs() - Returns always +ve number only. I am not sure, On which case you used Fabs()

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