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

Announcements
Only at Qlik Connect! Guest keynote Jesse Cole shares his secrets for daring to be different. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
MaANPREET
Contributor II
Contributor II

Measure Output Issue

I'm trying to calculate Number of Days, hours, minutes, seconds using this code for the attribute named as INC_DURATION_In_Seconds. However; i'm not getting the desired output. It gives me all zeros as in 0 days 00:00:00. What am i doing wrong. Please help.

Code:

Num(Floor(Sum({<[INCIDENTSTATUS] = {'Closed', 'Resolved'}>} Num([INC_DURATION_In_Seconds])) / 86400)) & ' day(s) ' &
If(Floor(Mod(Sum({<[INCIDENTSTATUS] = {'Closed', 'Resolved'}>} Num([INC_DURATION_In_Seconds])), 86400) / 3600) < 10, '0') & Num(Floor(Mod(Sum({<[INCIDENTSTATUS] = {'Closed', 'Resolved'}>} Num([INC_DURATION_In_Seconds])), 86400) / 3600)) & ':' &
If(Floor(Mod(Sum({<[INCIDENTSTATUS] = {'Closed', 'Resolved'}>} Num([INC_DURATION_In_Seconds])), 3600) / 60) < 10, '0') & Num(Floor(Mod(Sum({<[INCIDENTSTATUS] = {'Closed', 'Resolved'}>} Num([INC_DURATION_In_Seconds])), 3600) / 60)) & ':' &
If(Mod(Sum({<[INCIDENTSTATUS] = {'Closed', 'Resolved'}>} Num([INC_DURATION_In_Seconds])), 60) < 10, '0') & Num(Mod(Sum({<[INCIDENTSTATUS] = {'Closed', 'Resolved'}>} Num([INC_DURATION_In_Seconds])), 60))

INC_DURATION_In_Seconds
95000
97822
Labels (1)
5 Replies
Chanty4u
MVP
MVP

Try this 

Num(Floor(Sum({<[INCIDENTSTATUS]={'Closed', 'Resolved'}>} [INC_DURATION_In_Seconds]) / 86400)) & ' day(s) ' &  

Text(Floor(Mod(Sum({<[INCIDENTSTATUS]={'Closed', 'Resolved'}>} [INC_DURATION_In_Seconds]), 86400) / 3600), '00') & ':' &  

Text(Floor(Mod(Sum({<[INCIDENTSTATUS]={'Closed', 'Resolved'}>} [INC_DURATION_In_Seconds]), 3600) / 60), '00') & ':' &  

Text(Mod(Sum({<[INCIDENTSTATUS]={'Closed', 'Resolved'}>} [INC_DURATION_In_Seconds]), 60), '00')

MaANPREET
Contributor II
Contributor II
Author

Error in Expression: Text takes 1 parameter

marcus_sommer

Did you already trying to solve the task with: interval() ?

MaANPREET
Contributor II
Contributor II
Author

Yes, that's already been tried. Now, i have tried this one but its not giving me the desired output.

 

Num(Floor(Sum({<[INCIDENTSTATUS]={'CLOSED', 'RESOLVED'}>} [INC_DURATION_In_Seconds]) / 86400)) & ' day(s) ' &
Num(Floor(Mod(Sum({<[INCIDENTSTATUS]={'CLOSED', 'RESOLVED'}>} [INC_DURATION_In_Seconds]), 86400) / 3600), '00') & ':' &
Num(Floor(Mod(Sum({<[INCIDENTSTATUS]={'CLOSED', 'RESOLVED'}>} [INC_DURATION_In_Seconds]), 3600) / 60), '00') & ':' &
Num(Mod(Sum({<[INCIDENTSTATUS]={'CLOSED', 'RESOLVED'}>} [INC_DURATION_In_Seconds]), 60), '00')

 

It gives me 0 day(s) :: for the value 95038 seconds

marcus_sommer

Just give it another trial because it's working with: 

interval(95038 / 86400, 'd hh:mm:ss')