Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Anonymous
Not applicable
Author

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
Author

Hi Sean,

Thanks for your suggestion.

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

Regards

Anurag

Anonymous
Not applicable
Author

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
Author

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

Anonymous
Not applicable
Author

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

Anonymous
Not applicable
Author

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

Romancing with Set Analysis