# Qlik Sense App Development

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
New Contributor

## Count if with unique values

Hello,

I've been using Qliksense for a while now and so far every issue I had i could solve by a blog post in this community, it is very helpful! Now however I came across something I can't figure out how to do this. I have millions of records in the following format:

 Part ID Fault code 1 F01 2 F01 3 F03 3 F02 4 5 F03 5 F02 5 F01 6 7 8 F03 8 F02 9 10 F01

I want to show a KPI of the 'touch' on part level and show it in % of total produced parts. Which means I have to count the amount of Unique Part ID's with a fault code and divide it by the total amount of Unique Part ID's.

In this example it would be 6 parts with a fault code (some with multiple fault codes but this doesn't matter for the touch %) of 10 total parts giving 60% touch.

I hope someone can help me with this.

Geert

Tags (4)
1 Solution

Accepted Solutions
Valued Contributor III

## Re: Count if with unique values

Hi,

try like this,

=Count({<Faultcode={'*'}>}Distinct PartID)

/

Count(Distinct PartID)

3 Replies
Honored Contributor III

## Re: Count if with unique values

May be this

Num(Count({<PartID={"=Len(Trim(MaxString(Faultcode))) > 0"}>} DISTINCT PartID)/Count(DISTINCT PartID),'#0 %')

Regards,

Antonio

Valued Contributor III

## Re: Count if with unique values

Hi,

try like this,

=Count({<Faultcode={'*'}>}Distinct PartID)

/

Count(Distinct PartID)

New Contributor

## Re: Count if with unique values

Hi,

Both solutions worked, thanks a lot!

Geert

Community Browser