COGNOiSe.com - The IBM Cognos Community

IBM Cognos Analytics Platform => Cognos Analytics => Reporting => Topic started by: peewan on 20 Dec 2019 09:25:02 AM

Title: add Percentage row under Union list report
Post by: peewan on 20 Dec 2019 09:25:02 AM
I have the list report is union of 2 queries

Query 1:
Name '#of membership'
Measure: total all membership [ID]

Query 2:
Name "#of member had visit"
Measure: total all memberVisit ID

Report: union of 1 and 2.
outcome:
       NAME                      MEASURE
#of member had visit        8
#of membership               16


I would like to add Percentage under it which 8/16= 50%
How could I do that? Thank you
Title: Re: add Percentage row under Union list report
Post by: Andrei I on 20 Dec 2019 09:44:42 AM
Reading product documentation usually helps :-)
Title: Re: add Percentage row under Union list report
Post by: oscarca on 20 Dec 2019 12:29:54 PM
What happens if you just divide the two data items #of member had visit / #of membership ?
Title: Re: add Percentage row under Union list report
Post by: peewan on 23 Dec 2019 10:26:59 AM
Quote from: oscarca on 20 Dec 2019 12:29:54 PM
What happens if you just divide the two data items #of member had visit / #of membership ?

that not 2 different data items.
"#of member had visit" and  "#of membership" is the NAME in data item "GROUP NAME", and the value is in "Measure" data item.

basically, i just have 2 data items: Group, and Measure
Title: Re: add Percentage row under Union list report
Post by: oscarca on 27 Dec 2019 08:31:23 AM
I believe you can do this in two ways:

Example 1 "Join"
Query1= Company, Netline amount 2017 (Detailed filter Year = 2017)
Query2= Company, Netline amount 2018 (Detailed filter Year = 2018)
Final(Join between Query1 and Query2 by joining on Company)

Example 1 "Union"
Query1= Company, Netline amount 2017, Netline amount 2018 (0) (Detailed filter Year = 2017)
in Query1 you create an empty data item Calling it Netline amount 2018 so we can union on it.

Query2= Company,Netline amount 2017 (0) Netline amount 2018 (Detailed filter Year = 2018)
in Query2 you create an empty data item Calling it Netline amount 2017 so we can union on it.

Final: Create a new Query and union with Query1 and query2 and then create a new data item "Netline amount 2018/Netline amount 2017" to get the percentage.
Note that it is important to set Detail Aggregation to "Total" on the two data items "Netline amount 2018" and "Netline amount 2017". Otherwise you will get two rows instead of one.

Best regards,
Oscar
Title: Re: add Percentage row under Union list report
Post by: peewan on 27 Dec 2019 11:39:20 AM
Quote from: oscarca on 27 Dec 2019 08:31:23 AM
I believe you can do this in two ways:

Example 1 "Join"
Query1= Company, Netline amount 2017 (Detailed filter Year = 2017)
Query2= Company, Netline amount 2018 (Detailed filter Year = 2018)
Final(Join between Query1 and Query2 by joining on Company)

Example 1 "Union"
Query1= Company, Netline amount 2017, Netline amount 2018 (0) (Detailed filter Year = 2017)
in Query1 you create an empty data item Calling it Netline amount 2018 so we can union on it.

Query2= Company,Netline amount 2017 (0) Netline amount 2018 (Detailed filter Year = 2018)
in Query2 you create an empty data item Calling it Netline amount 2017 so we can union on it.

Final: Create a new Query and union with Query1 and query2 and then create a new data item "Netline amount 2018/Netline amount 2017" to get the percentage.
Note that it is important to set Detail Aggregation to "Total" on the two data items "Netline amount 2018" and "Netline amount 2017". Otherwise you will get two rows instead of one.

Best regards,
Oscar


Example1: Join - I easy to do new data item [Percence] = ([Netline amount 2017]/[Netline amount 2018] because it is 2 different data items.

I really want to do example 2: UNION

Union query just had 2 data item: [Company], and [Netline amount] (will be Netline amount 2017 or Netline amount 2018)
and created [new data item] = what? ( =Netline amount 2017/Netline amount 2018 is not work)

Thanks