Author Topic: Total two columns from different queries  (Read 1280 times)

Offline JohnnyCat

  • Associate
  • **
  • Posts: 3
  • Forum Citizenship: +0/-0
Total two columns from different queries
« on: 25 Jul 2006 11:45:25 am »
Hello,

I have two different queries in my report.  Both are a count of employee, but they are from different tables.  How can I calculate the sum of all employees in list A and employees in list B, i.e. have a grand total of all employees from both lists?  Also, there is no relationship between these two tables.  Some employees are stored in table A, others are stored in table B.  I am using Cognos 8.

Thanks for your help.
« Last Edit: 25 Jul 2006 01:10:18 pm by JohnnyCat »

Offline MFGF

  • Never knowingly correct
  • Super Moderator
  • Statesman
  • ******
  • Posts: 3,112
  • Forum Citizenship: +153/-3
  • Cognos Software Muppet
Re: Total two columns from different queries
« Reply #1 on: 26 Jul 2006 02:28:19 am »
If the queries have the same number of items (with the same data types) you can union the queries together into a higher-level query, and perform your calculation there.

Regards,

MF.
Meep!

Offline JohnnyCat

  • Associate
  • **
  • Posts: 3
  • Forum Citizenship: +0/-0
Re: Total two columns from different queries
« Reply #2 on: 26 Jul 2006 08:22:27 am »
Thanks,  that got me going.  The queries didnt have the same number of items, but I managed to work around it.

Offline mrcool

  • Statesman
  • ******
  • Posts: 265
  • Forum Citizenship: +27/-28
Re: Total two columns from different queries
« Reply #3 on: 28 Jul 2006 02:49:09 am »
Try 2 use tabular set....

Offline MFGF

  • Never knowingly correct
  • Super Moderator
  • Statesman
  • ******
  • Posts: 3,112
  • Forum Citizenship: +153/-3
  • Cognos Software Muppet
Re: Total two columns from different queries
« Reply #4 on: 28 Jul 2006 05:25:16 am »
Hi MrCool,

Just to clarify, there's no longer any such thing as a Tabular Set in Cognos 8, which JohnnyCat is using here.  Tabular Sets have been replaced by Query Unions in Cognos 8.

Regards,

MF.
Meep!

Offline mrcool

  • Statesman
  • ******
  • Posts: 265
  • Forum Citizenship: +27/-28
Re: Total two columns from different queries
« Reply #5 on: 07 Aug 2006 11:22:52 pm »
Oh ok...thank u

Offline tosty

  • Full Member
  • ***
  • Posts: 11
  • Forum Citizenship: +0/-0
Re: Total two columns from different queries
« Reply #6 on: 06 Sep 2006 12:19:12 am »
Hi JhonnyCat,

can you tell me how you were able to solve this issue.

Thanks...