COGNOiSe.com - The IBM Cognos Community

IBM Cognos Analytics Platform => Cognos Analytics => Reporting => Topic started by: bz_boy on 03 Jul 2018 09:57:56 AM

Title: Need help with Date filter Please!
Post by: bz_boy on 03 Jul 2018 09:57:56 AM
Hello all

I need help with a date filter. In sql the filter is as such:
where ((zS.Status = 'Active' and zS.ServiceActivationDate <= eomonth(DATEADD(month,-1,getdate())))
                    OR (zS.Status = 'Cancelled' and zS.CancelledDate > eomonth(DATEADD(month,-1,getdate()))))

How can I add this to a report in Cognos? I have tried everything but it is not returning the results I need as the SQL query is.

thanks in Advance!
Title: Re: Need help with Date filter Please!
Post by: dougp on 03 Jul 2018 10:16:28 AM
That works fine for me.  Please provide the filter expression you are trying to use in Cognos.
Title: Re: Need help with Date filter Please!
Post by: bz_boy on 03 Jul 2018 11:35:28 AM
I was actually able to get it to work using the below filter:

[Status] = 'Active' and [Service Activation Date] <= _add_months(current_date,-1)
or
[Status] = 'Cancelled' and [Cancelled Date] >= current_date
Title: Re: Need help with Date filter Please!
Post by: dougp on 03 Jul 2018 03:33:42 PM
Did you try this?

[Status] = 'Active' and [Service Activation Date] <= eomonth(dateadd({month},-1,getdate()))
or
[Status] = 'Cancelled' and [Cancelled Date] >= eomonth(dateadd({month},-1,getdate()))
Title: Re: Need help with Date filter Please!
Post by: bz_boy on 10 Jul 2018 01:34:28 PM
yes, they actually worked both ways. Thank you for your help!