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

Networkdays() shows wrong results when used between two table rows

Hello Community,

I'm using networkdays() to calculate the time duration between two date fields , it's showing correct answers when the two dates are from the same year but when the dates are from differents years the answers are not correct. has anyone here got the same problem using the formula ?

I'm using networkdays as an expression in a table between the two date dimensions.

Thank you for your help.

5 Replies
swuehl
MVP
MVP

I can't reproduce this here:

=NetWorkDays(MakeDate(2015,12,1),MakeDate(2016,1,27))

returns 42.

How does your expression look like?

Not applicable
Author

Im using this:

=NetWorkDays(Date_entree_dans_la_ged,Date_de_traitement)

im using the fields in my table  to calculate time between each line not static dates.

swuehl
MVP
MVP

What does

=Date_de_traitement - Date_entree_dans_la_ged

return as expression in your chart for the records with incorrect results?

How does your script code look like that generate these fields (reason why I am asking: Maybe the underlying numeric values is not really representing the date shown as text).

If possible, please post a small sample QVW that demonstrates your issue.

Not applicable
Author

=(Date_de_traitement - Date_entree_dans_la_ged)  also show's the wrong answers when the dates are from different years.

I'm getting the two date fields from a View in sql server under this format yyyymmdd and i transform them to the new format at the script using : date(date#("DATE_FIELD",'yyyymmdd'),'dd/mm/yyyy').

I will try to make a small QVW sample soon to demonstrates the issue.

Thank you again for your help.

swuehl
MVP
MVP

Are you using exactely this statement:

date(date#("DATE_FIELD",'yyyymmdd'),'dd/mm/yyyy')

?

Note that the format code for month is 'MM', not 'mm', which is the code for minutes.

Use

date(date#("DATE_FIELD",'YYYYMMDD'),'DD/MM/YYYY')

instead