COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: Todd129 on 23 Jan 2013 04:38:25 PM

Title: Elegant way to create workday only time period at report level?
Post by: Todd129 on 23 Jan 2013 04:38:25 PM
Hi there--

I have two timestamps as separate data items, and am calculating the time difference between the two at the report level.

Does someone have a quick elegant idea for how to calculate this time difference omitting weekends in RS? What I'm after is the expired number of workdays, and so far I have the total elapsed calendar time.

Kind regards, Todd
Title: Re: Elegant way to create workday only time period at report level?
Post by: RKMI on 23 Jan 2013 06:29:19 PM
Hi Todd,

Not sure abt the elegant part but, we do something similar which does work.

Date Data Item:  _day_of_week([Time].[Date].[Date],1)

Then Data Item for identifying the weekdays from weekend
Day of Week Total:

CASE
WHEN ([Day of Week] = 1) THEN (0)
WHEN ([Day of Week] = 2) THEN (0)
WHEN ([Day of Week] = 3) THEN (0)
WHEN ([Day of Week] = 4) THEN (0)
WHEN ([Day of Week] = 5) THEN (0)
WHEN ([Day of Week] = 6) THEN (1)
WHEN ([Day of Week] = 7) THEN (1)
END

I do a similar thing to declare holidays then join them on the Date
then have a Workday counter data item as such,

Wknd/Holiday Counter:
CASE
WHEN (([Holiday Counter] = 0) OR ([Day of Week Total] = 0)) THEN (1)
ELSE (0)
END

Running Total for the total in calander: running-total([Wknd/Holiday Counter])

I know it looks messy but does work.

Thanks,
RK
Title: Re: Elegant way to create workday only time period at report level?
Post by: Todd129 on 23 Jan 2013 11:23:22 PM
This is awesome -- thanks so much for supporting the community and sharing your expertise! :)

Todd
Title: Re: Elegant way to create workday only time period at report level?
Post by: RKMI on 24 Jan 2013 10:54:51 AM
Welcome :)