COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: fgarav on 10 Aug 2011 06:13:50 AM

Title: prompt question
Post by: fgarav on 10 Aug 2011 06:13:50 AM
Hi to all,
i have a prompt on a DMR model based on a TimeDimension, i use this for different scope, now i have a strange requirement that is if a select a mont , i have to obtain the data for the month that i select and the previous month..
example .. select MAY -> obtain APRIL and MAY...
Some idea ?????

bye
Title: Re: prompt question
Post by: rockytopmark on 11 Aug 2011 12:56:40 PM
Sure...

I would use the month number as the Use Value in the prompt and also in the report's filter.  The Filter that uses the parameter from this prompt needs to be an OR.

So for example, the filter expression might look like:

[Namespace].[querysubject].[Month] = ?pMonthNum?
OR
[Namespace].[querysubject].[Month] = (if(?pMonthNum? <> 1) then (?pMonthNum? - 1) else (?pMonthNum? + 11))

... you will also need a filter to account for the year, as in the case of January being the Month selection, so that you get last year's December (12).

HTH, M
Title: Re: prompt question
Post by: navissar on 13 Aug 2011 01:35:16 PM
If I'm not mistaken, you can use dimensional functions on DMR. parallelPeriod should do the trick if you're model's well-built. Also, try to avoid using filters on dimensional data, use context filters and sets instead.