COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: Ricardo Julio "Ricky" Villa on 23 Mar 2016 10:51:57 AM

Title: Date range filter for Cube query
Post by: Ricardo Julio "Ricky" Villa on 23 Mar 2016 10:51:57 AM
Hi,

I have a Report Studio report populated from a PowerPlay Cube.

The report has a start month prompt and an end month prompt.  Example MUN values the prompts will return are:

start month: [Saxon Sales Performance Cube].[All Dates].[All Dates].[Month]->:[PC].[@MEMBER].[20150101-20150131]
end month: [Saxon Sales Performance Cube].[All Dates].[All Dates].[Month]->:[PC].[@MEMBER].[20160401-20160430]

How do I apply a filter to only return data between these 2 periods (i.e. date range filter).

Cheers,

Ricky
Title: Re: Date range filter for Cube query
Post by: Ricardo Julio "Ricky" Villa on 23 Mar 2016 11:04:23 AM
Hi,

Sorry, error in my original post... been a long day :(

The prompts actually just return a month number, e.g. 1, 2, 3,4....12 and there are separate Year prompts.

The MUN's format for month categories are as given in original post, e.g.
[Saxon Sales Performance Cube].[All Dates].[All Dates].[Month]->:[PC].[@MEMBER].[20150101-20150131]

Cheers,

Ricky
Title: Re: Date range filter for Cube query
Post by: Ricardo Julio "Ricky" Villa on 23 Mar 2016 11:16:16 AM
Just worked it out (or found it on google)...

intersect(lastPeriods(-9999, parallelPeriod( [Saxon Sales Performance Cube].[All Dates].[All Dates].[Year],1,[Saxon Sales Performance Cube].[All Dates].[All Dates].[Month]->?p1?)),lastPeriods(9999, parallelPeriod([Saxon Sales Performance Cube].[All Dates].[All Dates].[Year],1,[Saxon Sales Performance Cube].[All Dates].[All Dates].[Month]->?p2?)))
Title: Re: Date range filter for Cube query
Post by: Ricardo Julio "Ricky" Villa on 23 Mar 2016 11:25:15 AM
Sorry that was for previous year periods :(

this is it:

intersect(lastPeriods(-9999, [Saxon Sales Performance Cube].[All Dates].[All Dates].[Month]->?p1?),
lastPeriods(9999,[Saxon Sales Performance Cube].[All Dates].[All Dates].[Month] ->?p2?))