COGNOiSe.com - The IBM Cognos Community

IBM Cognos Analytics Platform => Cognos Analytics => Dashboards => Topic started by: HenriP on 07 Jun 2021 03:00:42 AM

Title: How to count distinct items with filtered condition?
Post by: HenriP on 07 Jun 2021 03:00:42 AM
Hi

I have a problem creating a calculation in a cube dimension that should show how many items there are with a certain status.

I have used count( 1 within set "set") but this gives me the total number of items for every status. How could I filter the count so that it would only count the items with certain status?
Title: Re: How to count distinct items with filtered condition?
Post by: MFGF on 07 Jun 2021 10:33:05 AM
Quote from: HenriP on 07 Jun 2021 03:00:42 AM
Hi

I have a problem creating a calculation in a cube dimension that should show how many items there are with a certain status.

I have used count( 1 within set "set") but this gives me the total number of items for every status. How could I filter the count so that it would only count the items with certain status?

Hi,

I'm assuming Status is an attribute in the dimension?

You could try filtering the set using a filter() function before using this in your count()?

eg
count(1 within set filter([your set of members],[Your Status attribute] = 'Whatever Status you need'))

Cheers!

MF.