Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem With NetWorkDays Function

Hello Guys,

I have this table:

Cattura.JPG

On Qlikview to create the field number D to get the number of working days that have elapsed, I have used this script:

 
NetWorkDays(BSTORE4A, TIMESTAMP4A) - 2 + (1 - Frac(BSTORE4A)) + Frac(TIMESTAMP4A) AS GIORNI_PASSATI_4B
The script work correctly, but I have 5 values that are negative, without any reason, and I don't understand why. Someone can I help me?
Thank You

1 Solution

Accepted Solutions
antoniotiman
Master III

Hi Lorenzo,

NetWorkDays(BSTORE20, TIMESTAMP20)  =  0

4/12/2016 is Sunday

Regards,

Antonio

View solution in original post

9 Replies
m_woolf
Master II

In you formula, you refer to a field named TIMESTAMP4A, but in your attached pic you show a field named TIMESTAMP20

Not applicable
Author

Sorry, I did copy-paste from another script to test. The correct script is:

NetWorkDays(BSTORE20, TIMESTAMP20) - 2 + (1 - Frac(BSTORE20)) + Frac(TIMESTAMP20) AS GIORNI_PASSATI_4B

The problem remain. The script work fine but I have that strange 5 values

antoniotiman
Master III

Hi Lorenzo,

NetWorkDays(BSTORE20, TIMESTAMP20)  =  0

4/12/2016 is Sunday

Regards,

Antonio

Not applicable
Author

Ohhh man you're Amazing!!! I didn't think that the First date was on a festive day. Thanks you 😄

m_woolf
Master II

For the first row:

NetWorkDays(BSTORE20, TIMESTAMP20) = 22, but you are getting the answer 0.


Look at your data in QlikView. I suspect that the values for BSTORE20 and/or TIMESTAMP20 are not valid timestamps in Qlikview (they are probably strings that look like timestamps). When you send them to Excel, Excel interprets them as timestamps.





antoniotiman
Master III

Date/Timestamp Format is DD/MM/YYYY (Italy standard)

and 03/12-04/12/2016 are festive days.

Regards,

Antonio

m_woolf
Master II

test3.png

antoniotiman
Master III

Are You setting date/Timestamp format to DD/MM/YYYY ?

3 dec 2016 and 4 dec 2016

m_woolf
Master II

Antonio, That would have never occurred to me. I think you are correct.