5 Replies Latest reply: Jun 3, 2014 3:13 AM by Rajendra Nagargoje

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.

• Re: Number of days excluding friday

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

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

• Re: Number of days excluding friday

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.

• Re: Number of days excluding friday

Hi Gopinathan

-Rajendra

• Re: Number of days excluding friday

Hi you can even try like this

DateFieldName,

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

FROM ABC;

Now in setanalysis expression use

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

Regards

ASHFAQ