COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Framework Manager => Topic started by: jahnavi on 16 Mar 2011 06:10:24 AM

Title: Count distinct in cognos Fm
Post by: jahnavi on 16 Mar 2011 06:10:24 AM
Is count distinct works in cognosFM?
Title: Re: Count distinct in cognos Fm
Post by: Steve on 16 Mar 2011 11:36:42 AM
Yes, it does.
Title: Re: Count distinct in cognos Fm
Post by: jahnavi on 16 Mar 2011 01:03:18 PM
could you please explan me how can we do that in FM or in cube level
Title: Re: Count distinct in cognos Fm
Post by: cognostechie on 16 Mar 2011 05:20:30 PM
Which version are you using?

In 8.4, you can use a package from FM as the data source in Transformer. When you add the package , double-click on the properties of the Query subject in Transformer, go to General Tab, you will see a property called 'Auto-Summarize'. That one automatically add the distinct keyword to the query. It will remove the duplicates.

You can also create a Query subject in FM and use the word distinct in it.

Example -

You have a table to show Claims like this -

Claim ID  Claim Suffix   Claim Amount
----------------------------------------------

C01          001                 100
C01          002                  200
C01          003                   50
C02          001                 200

Essentially, there are only 2 claims so the Claim Count should be 2. So in the FM query, you
can hand type the SQL as:

Select distinct
      ClaimID
from database.dbo.Claim

After this, add a calculated column and type 1, Name it Claim Count. This will be the result:

Claim ID     Claim Count
------------------------------

C01                 1
C02                 1

Then just use the Claim Count as a regular measure in Transformer.       
Title: Re: Count distinct in cognos Fm
Post by: cognostechie on 16 Mar 2011 05:22:53 PM
Also check the properties of the measure. The 'Category Count' can also do this.
Title: Re: Count distinct in cognos Fm
Post by: jahnavi on 17 Mar 2011 01:16:11 PM
sorry for late reply.its tranformer 7.3
Title: Re: Count distinct in cognos Fm
Post by: cognostechie on 17 Mar 2011 04:43:35 PM
In that case, you can do the above in FM and export the Query Subject as an IQD to be used in Transformer.