COGNOiSe.com - The IBM Cognos Community

IBM Cognos Analytics Platform => Cognos Analytics => Reporting => Topic started by: HelloCognos on 09 Jul 2018 07:06:26 PM

Title: Adding two Rows Together for the same Line Item in the same Query
Post by: HelloCognos on 09 Jul 2018 07:06:26 PM
Hello, :)

We have a List that showing the below listing.
CAR LISTING

CAR                Repair Cost                 Maintenance Cost
BMW                  2700                              9255
                         6555

BENZ                 3700                              11255
                         7555



So I need the Maintenance Cost to be the addition of the two Repair Cost in
this Report Analytics List.

Could some please let me know if I can do this by using some sort of Calculation,

Thanks a lot!
Title: Re: Adding two Rows Together for the same Line Item in the same Query
Post by: oscarca on 10 Jul 2018 02:16:13 AM
try something like this:

[Maintance cost] = total([Repair Cost] for [Car])
Title: Re: Adding two Rows Together for the same Line Item in the same Query
Post by: Reinhard on 10 Jul 2018 02:38:16 AM
Hi,

sure, you have a column with the [car name] and one with the [repair cost] in your list. You now add a query calculation with following text:

total([repair cost] for [car name])

Regards
Title: Re: Adding two Rows Together for the same Line Item in the same Query
Post by: HelloCognos on 10 Jul 2018 06:52:29 AM
Thanks so much! that works.  :)

Now, I need to add up the rows and show the total on of the rows or a new row. So, 9255 is the addition
of Body and Tires repair cost.

something like below,

CAR             Type                      Repair Cost
BMW             Body                     2700
BMW             Tires                     6555
BMW             CAR Cost(Total)     9255           
             
So If I can create a new row using Calculation that shows the total of the Repair Cost (on a Row not column) that would
suffice my second need if you don't mind. This way I can hide the other rows or exclude them from the listing and only show
the total cost of 9255.

Thanks a lot again.
Title: Re: Adding two Rows Together for the same Line Item in the same Query
Post by: Reinhard on 10 Jul 2018 07:54:32 AM
Just mark your column and go to the menu and click the summarize button and since you probably want sums for your car names group that column first.
Title: Re: Adding two Rows Together for the same Line Item in the same Query
Post by: HelloCognos on 10 Jul 2018 02:32:08 PM
My apologies but not sure what you mean by the steps you describes. I just need to add the values of two rows under the BMW into an additional row (If possible). I think I'm understanding what you are saying. Let me try it again! Thanks so much!
Title: Re: Adding two Rows Together for the same Line Item in the same Query
Post by: oscarca on 11 Jul 2018 01:53:39 AM
Select Car column and repair cost column in the list and group them. After that select repair cost column and summarize it.
Title: Re: Adding two Rows Together for the same Line Item in the same Query
Post by: HelloCognos on 12 Jul 2018 06:37:35 AM
Thanks so much for your time, I'll try that. crazy day!