Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Ipsita20191
Contributor III
Contributor III

Qlik Sense Count Aggregate

Hello Guys,

I need one help regarding the below mentioned situation, I am pretty stuck here.

I am using

= if(aggr (count (distinct Status),[Person ID]) = 1 ,Status,'Dual')

Current Table        
Person ID Date Status    
Per1 1/1/2022 A    
Per1 2/1/2022 B    
Per1 5/1/2022 A    
         
Filter selection        
1/1/2022        
Person ID Date  Status New Status  
Per1 1/1/2022 A A  
         
Filter selection        
both(1/1/2022 and 2/1/2022)        
Person ID Date  Status New Status  
Per1 1/1/2022 A Dual  
Per1 2/1/2022 B Dual  
Filter selection        
both(2/1/2022 and 5/1/2022)        
Person ID Date  Status New Status  
Per1 2/1/2022 B Dual  
Per1 5/1/2022 A Dual  
Filter selection        
both(1/1/2022 and 5/1/2022)        
Person ID Date  Status New Status  
Per1 1/1/2022 A A  
Per1 5/1/2022 A A  
         
New Status will check what is the distinct count of column Status per Person
If Distinct count Status column is 2 that person then Dual , Otherwise put the Status column Value
Labels (1)
2 Solutions

Accepted Solutions
BrunPierre
Partner - Master
Partner - Master

Hope it works for you.

New status expression

IF(COUNT(AGGR(COUNT(DISTINCT Status),[Person ID],Status))='2','Dual',Status)

Output

peter_brown_0-1661421286955.png

 

 

View solution in original post

Ipsita20191
Contributor III
Contributor III
Author

It is Working. Thanks. We can use this as measure.

If we want to use this as dimension, this will work

aggr(if(count(distinct Status) >1 ,'Dual',Status),[Person ID])

View solution in original post

3 Replies
BrunPierre
Partner - Master
Partner - Master

Hope it works for you.

New status expression

IF(COUNT(AGGR(COUNT(DISTINCT Status),[Person ID],Status))='2','Dual',Status)

Output

peter_brown_0-1661421286955.png

 

 

Ipsita20191
Contributor III
Contributor III
Author

it Worked.Thanks.

It will be used as measure.

If we want to use as dimension i think we can use this one.

aggr(if(count(distinct Status) >1 ,'Dual',Status),[Person ID])

Ipsita20191
Contributor III
Contributor III
Author

It is Working. Thanks. We can use this as measure.

If we want to use this as dimension, this will work

aggr(if(count(distinct Status) >1 ,'Dual',Status),[Person ID])