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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
ariel_klien
Specialist
Specialist

Count of Working days

Hello all experts,
my problem is that I want in his function to extract the Number of Working day for the selected month.
my filed are:
source.ACTIVITY_MMsource.ACTIVITY_YYYY
012013
022013
032013
042013
052013
062013
072013
082013
this is my function:
=NetWorkDays(date#('01/'&source.ACTIVITY_MM&'/'&source.ACTIVITY_YYYY,'DD/MM/YYYY'),
if(text(GetFieldSelections(source.ACTIVITY_MM))=text(Date(ReloadTime(),'MM')),date(ReloadTime(),'DD/MM/YYYY')),
date#(
day(monthend(date#'01/'&max(GetFieldSelections(source.ACTIVITY_MM))&'/'&source.ACTIVITY_YYYY,'DD/MM/YYYY')))
&'/'&source.ACTIVITY_MM&'/'&source.ACTIVITY_YYYY))
For example if I chose MM=02, YYYY=2013 then the function will return 28,
                     if I chose MM=07, YYYY=2013 then the function will return 31,
                     if I chose MM=08, YYYY=2013 then the function will return 9 -( until the reload time)
Sadly it isn't working.
Any Idea?
BR
Ariel
1 Solution

Accepted Solutions
swuehl
MVP
MVP

You can use makedate() function instead of date#() date interpretation, which should make things much simpler:

=NetWorkDays(makedate(source.ACTIVITY_YYYY,source.ACTIVITY_MM),

if(text(GetFieldSelections(source.ACTIVITY_MM))=text(Date(ReloadTime(),'MM')),

ReloadTime(),

monthend(makedate(source.ACTIVITY_YYYY,source.ACTIVITY_MM)))

)

View solution in original post

2 Replies
swuehl
MVP
MVP

You can use makedate() function instead of date#() date interpretation, which should make things much simpler:

=NetWorkDays(makedate(source.ACTIVITY_YYYY,source.ACTIVITY_MM),

if(text(GetFieldSelections(source.ACTIVITY_MM))=text(Date(ReloadTime(),'MM')),

ReloadTime(),

monthend(makedate(source.ACTIVITY_YYYY,source.ACTIVITY_MM)))

)

ariel_klien
Specialist
Specialist
Author

Working fine.

Thanks.