COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: gosoccer on 02 Dec 2015 09:12:14 PM

Title: Case When and Going Back 30 Days as a Data Item in Report Author 10.2.1
Post by: gosoccer on 02 Dec 2015 09:12:14 PM
Hi folks,
I have a Data Item with the following way of calculating the count,
case
   when [Presentation View].[xxx].[TYPE] = 'A'
   then [Presentation View].[xxxx].[REC_ID]
   else null
end
And it is set to Count for the Aggregation.

Now I need to get this count for only for the last 30 days. I don't know
how to write the statement that would use a combination of above code
and the following to give me the last 30 day?

_add_days (_add_months (current_date,-1), -30)

Thx so much for your time.
Title: Re: Case When and Going Back 30 Days as a Data Item in Report Author 10.2.1
Post by: MFGF on 04 Dec 2015 05:45:14 AM
Quote from: gosoccer on 02 Dec 2015 09:12:14 PM
Hi folks,
I have a Data Item with the following way of calculating the count,
case
   when [Presentation View].[xxx].[TYPE] = 'A'
   then [Presentation View].[xxxx].[REC_ID]
   else null
end
And it is set to Count for the Aggregation.

Now I need to get this count for only for the last 30 days. I don't know
how to write the statement that would use a combination of above code
and the following to give me the last 30 day?

_add_days (_add_months (current_date,-1), -30)

Thx so much for your time.

Hi,

Report Author is a role. Do you mean Report Studio?

If so, how about:

case
   when [Presentation View].[xxx].[TYPE] = 'A' and [Presentation View].[xxx].[YourDateItem] >= _add_days(current_date,-30)
   then [Presentation View].[xxxx].[REC_ID]
   else null
end


MF.
Title: Re: Case When and Going Back 30 Days as a Data Item in Report Author 10.2.1
Post by: gosoccer on 04 Dec 2015 06:17:57 AM
I meant Report Studio. Sorry, I do some security stuff in here too.

Yes, thank you so much. Thx should the trick.

I'll try it.
:) :)