Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
DipeshVadgama
Partner - Creator II
Partner - Creator II

Counting distinct Value based on two field

Hi,

I am trying to count distinct value base on 2 Fields. Below is example,

Id's & Defect Code can be duplicate as per data, but I just need Unique count for ID & Defect Code.

like = Count(Distinct(ID) , Distinct(Defect Code))

Result = 5 ( Highlighted Yellow for example)

   

IDDefect Code
111119
211113
211117
3 -
4 -
411118
5 -
511122
511114
6 -
711123
8 -
7 Replies
prat1507
Specialist
Specialist

hi

Maybe this

If([Defect Code]<>'-',count(distinct(ID)))

DipeshVadgama
Partner - Creator II
Partner - Creator II
Author

Thanks Pratyush,

But is not working 😞

sunny_talwar

May be this

Count(DISTINCT {<ID = {"=Count([Defect Code]) > 0"}>} ID)

or

Count(DISTINCT {<[Defect Code] = {'*'}>} ID)

DipeshVadgama
Partner - Creator II
Partner - Creator II
Author

Thanks Sunny,

Count(DISTINCT {<[Defect Code] = {'*'}>} ID)


This works perfect.


Appreciate if you can explain this formula to me. DISTINCT {<[Defect Code] = {'*'}>}

sunny_talwar

The expression is just distinct counting IDs where Defect Code is not null ({<[Defect Code] = {'*'}>})

DipeshVadgama
Partner - Creator II
Partner - Creator II
Author

Great Thanks for you help.

sunny_talwar

No problem at all