COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: lalitha.nov20 on 18 Oct 2013 05:43:09 AM

Title: displaying last 14week date's in the value prompt .
Post by: lalitha.nov20 on 18 Oct 2013 05:43:09 AM
Hi,

I have a requirement where I have to show last 14 week starting from the currentweek in the value prompt.

When the report is executed, it should auto execute for current week and should have a prompt ion the report page showing last 14 week date's in the drop down value prompt.

i am using a DMR model and date's in the time dimension are in varchar format.

Please let me know how to go about it.

Thank you,
Lalitha
Title: Re: displaying last 14week date's in the value prompt .
Post by: wyconian on 18 Oct 2013 08:55:23 AM
HI

Do you have weeks in your time dimension?  If you do you can use a function like lag(time_dimension, 14) to give you the previous 14 weeks.

Good luck :-)
Title: Re: displaying last 14week date's in the value prompt .
Post by: charon on 19 Oct 2013 04:30:51 PM
iF you have a relational modell, you might create a query just for the prompt and use a detail filter with adddate" sysdate" function. The query should contain weeks only...

cheerz & gl
Title: Re: displaying last 14week date's in the value prompt .
Post by: lalitha.nov20 on 21 Oct 2013 01:22:26 AM
Hi,

"Do you have weeks in your time dimension?  If you do you can use a function like lag(time_dimension, 14) to give you the previous 14 weeks.

Good luck :-)"

I can use lag but my time dimension has date till 2016 and our i require to point to current system week and then display the last 14 weekd.

Thank you,
Lalitha
Title: Re: displaying last 14week date's in the value prompt .
Post by: wyconian on 21 Oct 2013 01:54:31 AM
OK so you need to identify the current week/day.  Do you have a flag in your date dimension that does that?  If not you can use the today() or now() function to identify the system run date when the report is run.

You can then use this date as a filter in your query to restrict the data
Title: Re: displaying last 14week date's in the value prompt .
Post by: FabianGaussling on 21 Oct 2013 08:30:53 AM
Hi,

in an oracle environment I would try to filter your prompt-query with something like:
 
     [Date Dimension]...[Date] between sysdate-7*14 and sysdate

Fabian
Title: Re: displaying last 14week date's in the value prompt .
Post by: lalitha.nov20 on 22 Oct 2013 12:30:32 AM
dimension date are in varchar format mm/dd/yyyy and system date is in date format. Can you provide met he filter expression how do I apply the filter on the date dimension.

Thank you,
lalitha
Title: Re: displaying last 14week date's in the value prompt .
Post by: Satheesh on 22 Oct 2013 01:59:42 AM
Hi,
Could u tell which type of model ur using, Relational or DMR...???
and what is Ur DB...???

Title: Re: displaying last 14week date's in the value prompt .
Post by: lalitha.nov20 on 22 Oct 2013 04:02:27 AM
I am using a DMR model
Title: Re: displaying last 14week date's in the value prompt .
Post by: Satheesh on 22 Oct 2013 04:25:51 AM
in Query try to use Filter like below



[Sales (analysis)].[Time].[Time].[Day].[Week of the year] between _week_of_year (current_date)-14 and _week_of_year (current_date)
and
[Sales (analysis)].[Time].[Time].[Year].[Year] = extract (year,current_date)


by using above query you can filter the last 14 Weeks from the current Week.


and Add Day Level as a data item if u have.




look the attachment...