COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: mycognosangel on 13 Oct 2016 08:43:02 AM

Title: ROW COUNTING/GROUPING
Post by: mycognosangel on 13 Oct 2016 08:43:02 AM
Hi
I asked a similar question earlier, but the solution I was offered didnt seem to work.
In the TABLE1, the first row has 2 occurences, the second row has 3 occurences in the table and the third row has just 1 occurence. I want an output like INTENDED OUTPUT table based on the TABLE1 information. Pls I need a clear and detailed solution and explanation

TABLE1
Country            Size             key
Holland             1020           Holland1020
France               800            France800
Estonia              300            Estonia300
France                800           France800
France                800           France800
Holland             1020           Holland1020

INTENDED OUTPUT
Country           Size              Key                 Count
Holland             1020           Holland1020        2
France               800            France800            3
Estonia              300            Estonia300          1
Title: Re: ROW COUNTING/GROUPING
Post by: Lynn on 13 Oct 2016 10:28:46 AM
Quote from: mycognosangel on 13 Oct 2016 08:43:02 AM
Hi
I asked a similar question earlier, but the solution I was offered didnt seem to work.
In the TABLE1, the first row has 2 occurences, the second row has 3 occurences in the table and the third row has just 1 occurence. I want an output like INTENDED OUTPUT table based on the TABLE1 information. Pls I need a clear and detailed solution and explanation

TABLE1
Country            Size             key
Holland             1020           Holland1020
France               800            France800
Estonia              300            Estonia300
France                800           France800
France                800           France800
Holland             1020           Holland1020

INTENDED OUTPUT
Country           Size              Key                 Count
Holland             1020           Holland1020        2
France               800            France800            3
Estonia              300            Estonia300          1

What was the other solution offered and what was the problem with the result? Is your package relational or dimensional?

Is your query set to auto group and summarize? If it is I would expect that you would only see the three distinct rows. Is there anything in your data source that uniquely identifies a row?

You can try a query calculation that uses a count function using country as the scope in the "for" clause. To get a correct result you may need a value that uniquely identifies each individual row. In your case, the "key" is not uniquely identifying a row.