COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: sspk on 26 May 2010 04:13:52 PM

Title: last working day of last month
Post by: sspk on 26 May 2010 04:13:52 PM
Hi all,
I am trying to calculate a measure value for 3 different dates (Today(what ever the date the user's select), last week last working day(based on the previous prompt value) , last month last working day).For this I am using 3 different queries with different filters and union them . I am able to do it for today.I am able to calculate last day of last month . But I want to  calculate for the last working day of last month.I even want to calculate last working day of last week.

I got last day of last month by using a filter some thing like

cast([As Of Date],date)=_add_days (_first_of_month (?AsofDate?),-1).

Any ideas  for last working of last week and last working day of last month will help me .


Thanks
Title: Re: last working day of last month
Post by: mvjcognos on 14 Jul 2010 03:42:57 AM
try this

max(add_months(sysdate,-1))

or

max(trunc(sysdate,'Month')-1)

from the above exp atleast one should work
here max function will take max date from the last month in the database if ur datbase contains 28 as friday then it will show 28 as max date.

or

try this it might work
last_day(add_months(rept_date,-1))

here last_day function will extract last day in the datbase for that month