Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Loeckli
Contributor III
Contributor III

Count column when value in another colum are the same

I have 2 columns, name and status.

I want to count the columns only when all have the same status for example, yes. 

Name Status
Jon

No

Jon Yes
Jon No
Kim Yes
Kim Yes
Kim  Yes
Tim Yes
Labels (4)
1 Solution

Accepted Solutions
LRuCelver
Partner - Creator III
Partner - Creator III

Here you go:

Sum(Aggr(If(Only(Status)='Yes', 1), Name)) / Count(distinct Name)

LRuCelver_0-1710338115454.png

 

View solution in original post

9 Replies
Clement15
Creator III
Creator III

Hello, what should your result look like? In a KPI, in a table?

LRuCelver
Partner - Creator III
Partner - Creator III

Can you please make an example with the input data and the expected result?

Loeckli
Contributor III
Contributor III
Author

Hi Clement15,

In the best case, it would be a KPI that shows the percentage of names for which all statuses are Yes. In the example above, this would be around 66%.

Loeckli
Contributor III
Contributor III
Author

I can not give you any input data, the only example is the table below.  The desired output should be : a KPI that shows the percentage of names for which all statuses are Yes. In the example above, this would be around 66%.

Clement15
Creator III
Creator III

Is this what you want?

Clement15_0-1710337649284.png

 

LRuCelver
Partner - Creator III
Partner - Creator III

Here you go:

Sum(Aggr(If(Only(Status)='Yes', 1), Name)) / Count(distinct Name)

LRuCelver_0-1710338115454.png

 

Loeckli
Contributor III
Contributor III
Author

No not exactly, The names are important to me. How many names have only YES entries. In my example I have 3 names, 1 name is only counted if all statuses are Yes. The problem is that the number of statuses per name can be different. Therefore, in my example above, 2 names out of 3 names would be completely on Yes, thus 66.6%. 

Clement15
Creator III
Creator III

ok, in this case the answer @LRuCelver should be suitable

Loeckli
Contributor III
Contributor III
Author

Thank you very much