If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Count Number of days between two selected dates

Started by vaneetdhiman, 26 Jul 2012 10:46:40 PM

Previous topic - Next topic

vaneetdhiman

Hi All,

I am required to calculate number of days between two slected dates at the prompt. For example, if a user selects 1 July,2012 as start date and end date as 7 July, 2012; the expression should tell me the number of Mondays (1), Tuesdays (1), Wednesdays (1), Thursdays(1) and Fridays(1).

I am using the following expression condition but it is not calculating properly. Can someone please let me know what is wrong with my expression?

round((_days_between (cast(?End Date?,date),_add_days(cast(?Start Date?,date),1)) - mod (2-(_days_between (cast(?Start Date?, date), 1900-01-01)),7)
)/7,0)


Thanks in advance.

Cheers, V

pricter

I propose to use three query items
The first one would be the [Date] in which are you going to apply the filter based on users selection
The second one would be the [Weekday] (for example you can fine which day of the week is from the date)
The third one [Count of Weekday] with expression count([Weekday]"

vaneetdhiman

Thanks pricter for your quick reply, appreciated. I will give a go to the suggested solution by you and will let you know if it worked for me.

However, considering my expertise oin Cognos, it may take me sometime :)

Anyway, thanks for your help :)