COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: satish217_1990 on 15 Feb 2017 03:12:48 AM

Title: New dataitem with Lookup for each grouped value
Post by: satish217_1990 on 15 Feb 2017 03:12:48 AM
Can someone provide your inputs on how I could achieve the below requirement in Report Studio?

Existing:

EmployeeID Status
123              Active
123              Inactive
456              Active

Need it like this: (If an EmployeeID has both Active and Inactive then only one row should appear and value should be 'Both')

EmployeeID   StatusNew
123                 Both
456                 Active
Title: Re: New dataitem with Lookup for each grouped value
Post by: hespora on 15 Feb 2017 03:23:49 AM

if (
  count (
    distinct [empStatus]
    for [empID]
  )
  =2
)
then ('both')
else ([empStatus])
Title: Re: New dataitem with Lookup for each grouped value
Post by: satish217_1990 on 15 Feb 2017 06:40:19 AM
Thanks hespora. It works. Just curious if any other possible method is available?
Title: Re: New dataitem with Lookup for each grouped value
Post by: Michael75 on 15 Feb 2017 11:04:59 AM
QuoteJust curious if any other possible method is available?

Sure. Just ask your DBA / ETL guy or gal to include this logic when they populate your datamart. You'll have a simpler & better-performing report.
Title: Re: New dataitem with Lookup for each grouped value
Post by: AnalyticsWithJay on 16 Feb 2017 11:00:30 AM
Quote from: satishfy on 15 Feb 2017 06:40:19 AM
Thanks hespora. It works. Just curious if any other possible method is available?

There are less efficient ways, but hespora's solution is the ideal and common approach for relational structures. You can define custom groupings when working with dimensional data.