COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: psandhya408 on 29 Mar 2013 11:37:16 AM

Title: bucket conept
Post by: psandhya408 on 29 Mar 2013 11:37:16 AM
Hi I am new to cognos. I heard the word bucket in reports. Can anybody please explain me what is bucket and give me an example

Thanks in advance
Title: Re: bucket conept
Post by: calson33 on 29 Mar 2013 12:35:03 PM
I am also new to cognos, so I am not sure if it is a particular thing, but in general you "bucket" data into groups.

for example, if you had a table of people, and you wanted to report on their ages, you might "bucket" them into groups like
0-20
21-35
36-50
> 50

How you achieve that bucketing varies. There may be a way to do it in cognos, but I usually do it on the database side, using something like a case statement.


Select name, location,
case age when <=20 then 'BUCKET 1'
when between 21 and 35 then 'BUCKET 2'
etc.

hth
John
Title: Re: bucket conept
Post by: psandhya408 on 29 Mar 2013 01:22:17 PM
Thanks calson33
Title: Re: bucket conept
Post by: psandhya408 on 29 Mar 2013 01:23:21 PM
can any body help me to achieve this in cognos
Title: Re: bucket conept
Post by: bpothier on 29 Mar 2013 02:24:40 PM
do you have a specific data set in mind - so we can be as specific as possible
Title: Re: bucket conept
Post by: psandhya408 on 29 Mar 2013 03:01:58 PM
Quote from: bpothier on 29 Mar 2013 02:24:40 PM
do you have a specific data set in mind - so we can be as specific as possible


I have to find the number of people who are ranging at different ages and I have only birthdate . How should i find the number of people in cognos using buckets.

Age 10-20 ,Age 21-30
Title: Re: bucket conept
Post by: cognostechie on 29 Mar 2013 03:35:50 PM
The age is the difference between today's date and the DOB. Cognos has a function to determine today's date which is current_date. If you subtract the DOB from the current_date, you get the number of days. Convert that to years and you get the Age.

_Years_Between(current_date,[DOB])     --  will give you the age. Let's say you name is as Age.

Once you get this, you can create another data item which will create the buckets:

Case
   when (Age <= 10) then ('0-10')
   when (Age >10 and Age <= 20) then ('11-20')
   when ....
   else ...
Endcase

will give you the Age Group.