Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

How to count unique values ?

Hi All,

I am new to QlikSense. I need to calculate the unique count of variables in a table/column. For e.g.

Exit TypeMonthLocation
VoluntaryJanuaryPune
InvoluntaryJanuaryPune
VoluntaryFebruary

Bangalore

Now I need to calculate = (Total number of Volunatry cases)/(Total number of Volunatry cases+Total number of Involunatry cases)

Thanks

Anurag Gupta

6 Replies
sod
Contributor

Re: How to count unique values ?

Hi Anurag,

Try using set analysis in one of the measures of the table.

Example:

Count({<Type={'Volunatry'}>} ID_Field) / Count({<Type={'Volunatry','Involunatry'}>} ID_Field)

Not applicable

Re: How to count unique values ?

Hi Sean,

Thanks for your suggestion.

Can you please help me understand ID_Field ? What is the pupose of this ?

Regards

Anurag

sod
Contributor

Re: How to count unique values ?

Basically the ID_Field represents a unique key field from the application's data model.  From my set analysis syntax above, this is the item that gets counted.  You can replace the ID_Field text with any other field you'd like.

Cheers,

Sean

Not applicable

Re: How to count unique values ?

HI Sean,

I have used follwing expression.

Count({<Type={'Volunatry'}>} [Exit Type]) / Count({<Type={'Volunatry','Involunatry'}>} [Exit Type])

This is showing error.

Am I iunderstanding it correct - : ID_Field is the column name ?

Does 'Type' has any significance ?

Regards

Anurag

sod
Contributor

Re: How to count unique values ?

Both Type and ID_Field names in the expression should be replaced with the appropriate column names from your data model.  Hope that helps!

sod
Contributor

Re: How to count unique values ?

Here is also a fantastic post from QlikCommunity that goes over the set analysis syntax.

Romancing with Set Analysis

Community Browser