COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: Web2CRM on 08 Jul 2013 12:15:48 AM

Title: SOLVED: Group Column Counts
Post by: Web2CRM on 08 Jul 2013 12:15:48 AM
Hi,

I need some help about the following:

1.) I have a list report that pulls duplicate data in different unique folder locations.
2.) Ex:
     Column ID                      Column ID Name               Column Location
     ===============================================
     ID001                             ID001_A                            DIR_LOC_01
     ID001                             ID001_A                            DIR_LOC_02
     ID001                             ID001_A                            DIR_LOC_03
     ID001                             ID001_B                            DIR_LOC_04   
     ID002                             ID001_C                            DIR_LOC_01
     ID002                             ID001_A                            DIR_LOC_02

3.) I want to pull the counts of those Column IDs that have duplicates,so the result would be like this:
     Column ID and Column ID Name was grouped.

     Column ID                      Column ID Name               Column Location                    Counts of Column ID
     ======================================================================
     ID001                             ID001_A                            DIR_LOC_01                                       4
                                                                                     DIR_LOC_02
                                                                                     DIR_LOC_03
                                            ID001_B                            DIR_LOC_04   
     ID002                             ID001_C                            DIR_LOC_01                                        2
                                            ID001_A                            DIR_LOC_02

4.) ID001 appears 4 counts if four different locations and ID002 appears 2 counts in two different locations.

5.) I tried to use COUNT, TOTAL(COUNT(, but the report return 1 count for each row because of the Column Location is unique.

     Column ID                      Column ID Name               Column Location                    Counts of Column ID
     ======================================================================
     ID001                             ID001_A                            DIR_LOC_01                                        1
                                                                                     DIR_LOC_02                                        1
                                                                                     DIR_LOC_03                                        1
                                            ID001_B                            DIR_LOC_04                                        1
     ID002                             ID001_C                            DIR_LOC_01                                        1
                                            ID001_A                            DIR_LOC_02                                        1

Any help will be much appreciated, Thanks!!!
Title: Re: Group Column Counts
Post by: HalfBloodPrince on 08 Jul 2013 12:31:31 AM
try this
count ([ Column Location] for [ Column ID] )

then set group span property  of  this column to  [ Column ID]
Title: Re: Group Column Counts
Post by: Web2CRM on 08 Jul 2013 02:39:50 AM
Thanks HalfBloodPrince for the suggestion..

I already figure out a solution similar to what you have,

I group the [Column ID] and created a computed Data Item named as [Counts of Column ID] with expression aggregate(count([Column Location] for [Column ID], then I group the [Counts of Column ID].


Thanks!!!