Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
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: 
shivi_
Contributor II
Contributor II

Derive count based on dupcount

HI,

I have a table where we have patient data and respective duplicate count created in backend. Now the table looks like below with other columns. I want to have a sum of non unique entries for per subject where dupcount is greater than 1. Pls help

 

SubjectNO.       dupcount

123                     1

123                      2

123                      22

234                     4

234                     5

234                     6

234                     1

345                      4

456                     4

457                      1

567                       1

567                        2

567                       3

Labels (3)
1 Solution

Accepted Solutions
edwin
Master II
Master II

a little adjustment:
Sum({<dupcount = {">1"}>} dupcount)

View solution in original post

6 Replies
Chanty4u
MVP
MVP

Try this 

Sum({<dupcount = {"=dupcount > 1"}>} dupcount)

 

shivi_
Contributor II
Contributor II
Author

Thankyou for your reply 😁

Sorry but the above does not gives the expected result. Currently I am very new to Qlik and use basic functions only. In my screenshot you can see my formula gives output for the 1st record but also print the same value for other subjects too. Can we add a group by too pass the alternate dimensions that might serve the purpose.

edwin
Master II
Master II

a little adjustment:
Sum({<dupcount = {">1"}>} dupcount)

shivi_
Contributor II
Contributor II
Author

The above gives the same output as suggested by Chanty. See the png file for more details.

edwin
Master II
Master II

your problem statement is wrong, from your pic, you are summing 1 and not the field - maybe what you need is a count or 

Sum({<dupcount = {">1"}>} 1)

edwin
Master II
Master II

you maybe need to reevaluate what you want - you may want the count of SubjectNo - also depending on both your data model and requirements, you may want a count distinct

count(distinct {<dupcount = {">1"}>} SubjectNo)