Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
lee_chandler
Contributor II
Contributor II

Changing Duration From Calendar Days to Working Days

Hi I need to change the duration in my dashboard from calendar days into working days.

I know I need to use the Network days function however I've never used this before being rather new to the qlikview world.

this is my current load for the Duration:


IF(WI_AED>0,(Timestamp(TIMESTAMP#(WI_AED&' '&WI_AET,'YYYY-MM-DD hh:mm:ss'))-Timestamp(TIMESTAMP#(WI_CD&' '&WI_CT,'YYYY-MM-DD hh:mm:ss'))),(utc()-Timestamp(TIMESTAMP#(WI_CD&' '&WI_CT,'YYYY-MM-DD hh:mm:ss')))) AS WI_DURATION,

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Try

IF(WI_AED>0,

Networkdays(TIMESTAMP#(WI_CD&' '&WI_CT,'YYYY-MM-DD hh:mm:ss'), TIMESTAMP#(WI_AED&' '&WI_AET,'YYYY-MM-DD hh:mm:ss')),

NetWorkdays(TIMESTAMP#(WI_CD&' '&WI_CT,'YYYY-MM-DD hh:mm:ss'), utc() )

) AS WI_DURATION,

View solution in original post

6 Replies
sunny_talwar

Do you need your duration in Days and Hours or just days?

lee_chandler
Contributor II
Contributor II
Author

Hi Sunny, days and hours.

swuehl
MVP
MVP

Try

IF(WI_AED>0,

Networkdays(TIMESTAMP#(WI_CD&' '&WI_CT,'YYYY-MM-DD hh:mm:ss'), TIMESTAMP#(WI_AED&' '&WI_AET,'YYYY-MM-DD hh:mm:ss')),

NetWorkdays(TIMESTAMP#(WI_CD&' '&WI_CT,'YYYY-MM-DD hh:mm:ss'), utc() )

) AS WI_DURATION,

swuehl
MVP
MVP

If you need the working time, given a begin and end time on each working day, you can look into

Re: Calculate hours between two Date/Time strings

sunny_talwar

Stefan, if we need just days, why not just use WI_CD?

IF(WI_AED>0,

Networkdays(Date#(WI_CD, 'YYYY-MM-DD'), Date(WI_AED, 'YYYY-MM-DD')),

NetWorkdays(Date#(WI_CD, 'YYYY-MM-DD'), UTC())) AS WI_DURATION,

swuehl
MVP
MVP

That's right,

you only need the date part, and if that's what WI_CD is describing (and it looks like this), this will be enough.