COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: Zara on 01 Jun 2009 06:49:06 AM

Title: Formula question
Post by: Zara on 01 Jun 2009 06:49:06 AM
Hi, I have two objects [Hour] and [Day].
How I make formula which returns data only from mon - fri 17 pm - 8 am and totally saturdays and sundays?
Title: Re: Formula question
Post by: Mohan11 on 01 Jun 2009 07:19:40 AM
In cognos report studio vendor specific functions, we have a function called 'day of week' using this function you will get your desired data.
Title: Re: Formula question
Post by: Gopinath on 01 Jun 2009 07:30:43 AM
If you want 2 different totals for a measure value, create 2 data items


[Data item1] for Sat - Sun
Total( if ([Day] in (1,7)) then ([Measure]) else (0) )

[Data item2] for Mon - Fri
Total( if ([Day] Not in (1,7) AND [Hour] Between Starttime AND Endtime) then ([Measure]) else (0))
Title: Re: Formula question
Post by: Zara on 02 Jun 2009 01:44:18 AM
Hi,

I need only one total sum. I didnt get those exaples to work.

Do you have examples how that day of week -function work? I have not use it earlier. 

Thanks for your replies.
Title: Re: Formula question
Post by: blom0344 on 02 Jun 2009 08:26:48 AM
_day_of_week is not a vendor specific function. It is listed under the date/time functions as a Cognos function. The tip on the function explains very precisely how it should be used  ;)