COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: mbianka on 12 Nov 2018 07:05:02 AM

Title: Calculate difference between dates use only working days
Post by: mbianka on 12 Nov 2018 07:05:02 AM
Hello.

I want to calculate difference between dates. The running-different function would be OK, but this use every day. I need just working days. (The working days can be found in WORKPERIOD table)

The running-different function do this:
running-difference ( julian_day( [DATE] ) for [ID])

ID                Date          Difference    Difference I need
1234          2018-10-24        0                 0
1234          2018-10-25        1                 1
1234          2018-10-29        4                 2 , because 10-27, 10-28 is non-working day
1234          2018-10-31        2                 2


Could someone help me how ,,filtered non-working day" in calculation?

Thank you.

(Cognos 10.2 Report Studio)
Title: Re: Calculate difference between dates use only working days
Post by: Invisi on 27 Nov 2018 09:15:16 AM
How are these working days stored in this table? Maybe you can do a count of some sort where the working days are in a date range. When a working day is represented with a flag or Boolean column, maybe you can count those.
Title: Re: Calculate difference between dates use only working days
Post by: khabaleshri on 27 Nov 2018 12:27:29 PM
You can use  _day_of_week(Date,1) not in (6,7) in filter and then do diffence calculation