Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Number of days excluding friday

Hi,

I need to calculate the number of days between the two dates excluding the Fridays.

For Ex,

1.

Date1 : 01-Jun-2014

Date2 : 10-Jun-2014

No .of days =9, because 6th Jun 2014 is Friday

2.

Date1 : 01-Jun-2014

Date2 : 20-Jun-2014

No .of days =17, because 6th,13th and 20th Jun 2014 are Fridays.

Thanks in Advance.

5 Replies
its_anandrjs

In your load script create a WeekDay field and then use in expression like

Load 

Weekday(DateField) as Weekday

From Loaction;

And in expression use it like

=Count( {<Weekday -= {'Fri'} >}  YourDatefieldHere)

By doing this calculation from your data this expression exclude only friday dates and count rest of the dates

tresesco
MVP
MVP

Something like:

=(EndDate-StartDate-Num(WeekDay(StartDate))-Floor(EndDate-StartDate-Num(WeekDay(StartDate))/7-If(Num(WeekDay(StartDate)<5,1,0)

This '5' stands for Saturday which may vary based on your time setting.

I feel there should be a simpler solution.

Not applicable
Author

Hi Gopinathan

Please find attachment hope this will help you

-Rajendra

ashfaq_haseeb
Champion III
Champion III

Hi you can even try like this

LOAD

     DateFieldName,

     If(WeekDay(DateFieldName) = 'Fri' , 1, 0) AS WeekEndFlag

FROM ABC;

Now in setanalysis expression use

=Count({<WeekEndFlag = {0}>} DateFieldName)

Regards

ASHFAQ

Not applicable
Author

soln.png