Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Unique count of fields in single column depending upon the condition

Hi,

I am trying to count number of unique countries in single path of travel whose rank is B and funtrip is 1

For eg

  

Travel PathCount of Country=[Fun Trip]
Dubai>Dubai>Dubai>England>England>England>England>England>England>England>England>England>Scotland>Scotland>Scotland>Scotland>Scotland>Scotland>Scotland>Scotland>Dubai>Denmark221

So in above row

Dubai,England,Scotland are countries which are unique countries in travel path which has funtrip 1.

So the result table should look like this

Countries       Count

Dubai              1

Denmark          0

England            1

Scotland           1

Hope i am clear with my problem, attached is the QVW and data file

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Are you looking for

Country Sum({<[Fun Trip] = {1},Rank={'B'}>}Aggr( Count(DISTINCT Country),Path,Country))
Dubai4
England1
Scotland4

View solution in original post

6 Replies
swuehl
MVP
MVP

Maybe like this?

Country Sum({<[Fun Trip] = {1}>}Aggr( Count(DISTINCT Country),Path,Country))
Denmark4
Dubai4
England4
Scotland5
Not applicable
Author

Only one issue, Rank should be B only for the countries to be counted.

Can we have two conditions in that ?

swuehl
MVP
MVP

Are you looking for

Country Sum({<[Fun Trip] = {1},Rank={'B'}>}Aggr( Count(DISTINCT Country),Path,Country))
Dubai4
England1
Scotland4
Not applicable
Author

Formula seems to be right but somehow i am not getting the desired count of unique countries.

swuehl
MVP
MVP

What would be the correct count?

Not applicable
Author

Thanks Stefan,

I was doing something wrong.Your solution worked fine