COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: suhas_bhat on 31 Jul 2013 04:23:27 AM

Title: How to use the 'for' while using summary functions effectively?
Post by: suhas_bhat on 31 Jul 2013 04:23:27 AM
Hi All,
   Below is an example of my tabular data in cognos 10.
A  B    C
----------
1 Q1 10
1 Q2 20
1 Q3 30
2 Q1 40
2 Q2 50
2 Q3 60

I need the total of the respective Qs i.e. my summary should have Q1=50,Q2=70 and Q3=90.

As of now i created a new data item with the coding [total(C) for B] but am getting weird values.
Is this the wrong approch am following? How do i use the for clause effectively to get  my output?
Also all the data items in this query have their aggregate function and rollup aggregate function properites set to none.

One of the solutions was to pull this query into another query Qa<-Qb and do away with the col.A, then i got the right values but is there any better way as this would incease the number of queries.
Title: Re: How to use the 'for' while using summary functions effectively?
Post by: Lynn on 31 Jul 2013 07:53:23 AM
I think column C should have an aggregate and rollup aggregate function as automatic or total. If your layout includes only columns B and C and the query is set to auto group and summarize then you should get the totals automatically with the proper aggregate setting on C.

If you really need the total function then I don't see what you've done wrong. What is weird about the values?
Title: Re: How to use the 'for' while using summary functions effectively?
Post by: suhas_bhat on 01 Aug 2013 04:41:24 AM
The values are weird because they move into thousands. Eg: 10+29+19+33 which should give 91 gives 2391 instead.
Title: Re: How to use the 'for' while using summary functions effectively?
Post by: Satheesh on 01 Aug 2013 05:04:54 AM
Hi,


Remove A then you can get Ur result...


In a new Query take B and C only...
Because A is having two level Hierarchy...