COGNOiSe.com - The IBM Cognos Community

IBM Cognos Analytics Platform => Cognos Analytics => Reporting => Topic started by: oscarca on 27 Aug 2019 02:41:13 AM

Title: Total row for percentage calculation issue
Post by: oscarca on 27 Aug 2019 02:41:13 AM
Hello Cognoise,

I am having quite some issue getting a calculation to show correct result. Here is an example to illustrate the problem:

                        Invoice             Budget                  Invoice/Budget              (Invoice/Budget) / Budget   
USA                     15                     10                             1.5                                      0.2
UK                       10                     12                              0.8                                     0.1
France                  5                       4                               1.3                                     0.3
Total row              30                    26                               3.6                         (here I want it to take 3.6 / 26) but for some reason it takes 1.2 /26 because if you take 30/26 = 1.2

So even though [Invoice/Budget] displays 3.6 (1.5 + 0.8 + 1.3), the total row for [(Invoice/Budget) / Budget]  takes the value 1.2 (30/26) instead...
                             
Title: Re: Total row for percentage calculation issue
Post by: Kiran Kandavalli on 28 Aug 2019 03:33:58 PM
which version of cognos you are using?

Approach 1

1) You can unlock the page objects (Structure --> uncheck lock page objects ). Delete the data item in total row last column.
2) By default cognos creates the below data items in your query
   
         a) Total(Invoice)
         b) Total(Budget)
         c) Total(Invoice/Budget)

3) Drag the layout calculation and the expression should be like Total(Invoice/Budget) / Total(Budget) - I mean Data item 3 / Data item 2 as in Step 2.


Approach 2

Try changing the below options

   a) Detail Aggregation - Total
   b) Summary Aggregation - Calculated


Thanks!
Kiran

Title: Re: Total row for percentage calculation issue
Post by: oscarca on 29 Aug 2019 01:36:22 AM
Hello Kiran,

Thanks for the reply! I am using CA 11.1.2. I will try to see if the approach works.

//Oscar
Title: Re: Total row for percentage calculation issue
Post by: oscarca on 29 Aug 2019 01:48:36 AM
I dont seem to be able to delete the total cell of the last column and changing the aggregation didnt do any difference.
Title: Re: Total row for percentage calculation issue
Post by: oscarca on 29 Aug 2019 05:02:07 AM
I selected "Define Content" on the Total row cell for the "(Invoice/Budget) / Budget"   Data item, unlocked the page objects and placed a Layout calculation as you said Kiran and it actually solved the calculation (Y) Thank you !

Best regards,
Oscar
Title: Re: Total row for percentage calculation issue
Post by: Cognos_Jan2017 on 29 Aug 2019 10:07:29 AM
Kiran - Excellent explanation.

I just gave up an "Applaud."

Look forward to reading more on your Posts.

Thank you, Bob
Title: Re: Total row for percentage calculation issue
Post by: Cognos_Jan2017 on 29 Aug 2019 10:10:53 AM
Kiran - Did autocorrect bite me on my tablet?

Correction ...
I just gave you an "Applaud."
Title: Re: Total row for percentage calculation issue
Post by: oscarca on 30 Aug 2019 02:19:53 AM
I agree with Cognos_Jan (Y)