COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: karthik12345 on 27 Jan 2016 02:49:36 AM

Title: to get last 4 months data
Post by: karthik12345 on 27 Jan 2016 02:49:36 AM
Hi all,
  I am using tm1 cube as a data source in cognos, my requirment is i need to show last 4 months data indivisually and the report should be dynamic. Please suggest me how can i get this.

Thanks,
Karthee
Title: Re: to get last 4 months data
Post by: BigChris on 27 Jan 2016 03:12:57 AM
Have you got a rolling 4 month dimension in your cube?
Title: Re: to get last 4 months data
Post by: Lynn on 27 Jan 2016 03:35:40 AM
A relative time dimension is the best way to go for sure.

If, however, you need to compute it you could use the tail function to get the last member of your date dimension, and then use the lastPeriods function to get a set of the last four members.




lastPeriods ( 4 , tail ( members ( [YourCube].[YourDateDim].[YourDateHierarchy].[YourMonthLevel] ) ) )



Title: Re: to get last 4 months data
Post by: BigChris on 27 Jan 2016 03:44:29 AM
I really need to start getting into these cube things...
Title: Re: to get last 4 months data
Post by: karthik12345 on 27 Jan 2016 03:51:23 AM
Thanks Big chris and lynn,

  i attached my  time dimension hierarchy , is the above condition works for this

Thanks,
Karthee
Title: Re: to get last 4 months data
Post by: Lynn on 27 Jan 2016 04:40:37 AM
Quote from: BigChris on 27 Jan 2016 03:44:29 AM
I really need to start getting into these cube things...

It is mind-bending! I learned a ton here on Cognoise from posts by the lovable Muppet and CognosPaul.

Quote from: karthik12345 on 27 Jan 2016 03:51:23 AM
Thanks Big chris and lynn,

  i attached my  time dimension hierarchy , is the above condition works for this

Thanks,
Karthee

Sorry Karthee, I don't know how to answer your question because I don't understand your hierarchy. What I'd normally expect to see would be a hierarchy that has something like Year > Quarter > Month, perhaps even with days or weeks at the lowest level. Yours appear to be aggregate YTD groupings of some sort. I've not worked with TM1 cubes so I'm not sure if there are nuances there I'm unfamiliar with.

The expression I gave you would find the last member in a particular level and then work backwards to create a set that includes that member along with the three previous members. Since you asked how to get the last four months I assumed you have a date hierarchy with a month level in it. While the expression might work in so far as you get four members back without an error message, that doesn't mean that it satisfies your requirement.

Title: Re: to get last 4 months data
Post by: karthik12345 on 27 Jan 2016 05:04:24 AM
Thanks Lynn,
    Actually my problem is same the hierarchy is different ,i am confused how to get the last four months data by using this hierarchy.
   Tm1  cube is different compare to the normal transformer cubes.

Thanks,
Karthee
Title: Re: to get last 4 months data
Post by: sdf on 27 Jan 2016 07:08:27 PM
In your Tm1 cube, don't you have any other alias for Month dimension?
Title: Re: to get last 4 months data
Post by: karthik12345 on 28 Jan 2016 03:44:32 AM
Hi,
  I can see some other hierarchy,can  get my requirement by using this. pls find the hierarchy screenshot in attachment.

Thanks,
Karthee   
Title: Re: to get last 4 months data
Post by: Lynn on 28 Jan 2016 03:59:38 AM
Quote from: karthik12345 on 28 Jan 2016 03:44:32 AM
Hi,
  I can see some other hierarchy,can  get my requirement by using this. pls find the hierarchy screenshot in attachment.

Thanks,
Karthee   

Did you try what I suggested?
Title: Re: to get last 4 months data
Post by: MFGF on 28 Jan 2016 04:25:21 AM
Quote from: karthik12345 on 28 Jan 2016 03:44:32 AM
Hi,
  I can see some other hierarchy,can  get my requirement by using this. pls find the hierarchy screenshot in attachment.

Thanks,
Karthee   

Does your hierarchy have defined level names? Is there a Month level?

MF.
Title: Re: to get last 4 months data
Post by: karthik12345 on 28 Jan 2016 04:37:20 AM
yes, i can see the month levels

@lynn: I tried it showing error,i tried like this  [Cube].[DateDim].[DateHierarchy].[MonthLevel]

Thanks,
  Karthee
Title: Re: to get last 4 months data
Post by: MFGF on 28 Jan 2016 05:43:45 AM
Quote from: karthik12345 on 28 Jan 2016 04:37:20 AM
yes, i can see the month levels

The attachment you included shows month members, not a month level. Does your hierarchy have defined level names? Do you have a month level you can select from the package tree?

Quote from: karthik12345 on 28 Jan 2016 04:37:20 AM
@lynn: I tried it showing error,i tried like this  [Cube].[DateDim].[DateHierarchy].[MonthLevel]

Thanks,
  Karthee

Are you saying you used [Cube].[DateDim].[DateHierarchy].[MonthLevel] literally in your expression? I think you misunderstood - Lynn's post was indicative of the structure you usually find in a cube. You need to use the actual names for the cube, dimension, hierarchy and level defined in your package.

MF.