Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
SL2
Contributor III
Contributor III

find records with same dimensions

hi everyone! I am new to Qlik sense, can anyone help me with this?

my table is looking like

SL2_1-1624057103815.png

and I want to find records with same [transaction date] and same [staff ID] but having more than 1 [cost center code],

so here entry ID 1 & 2 are records I want, and I expect to create a new field [entry I am looking for] to distinguish these entries, i.e. 

SL2_2-1624057396655.png

can anyone know how to figure this out? Thanks!

 

 

 

Labels (2)
1 Solution

Accepted Solutions
jbhappysocks
Creator II
Creator II

Hi!

Based on your example:

if(Count(total <[staff ID], [transaction date]> [cost center code])>1,'Yes','No')

(Entry 6 and 7 are also supposed to be highlighted right?)

jbhappysocks_0-1624084629607.png

If you want to create a table with only the Yes entries, like this:

jbhappysocks_2-1624085032996.png

You change it to if(Count(total <[staff ID], [transaction date]> [cost center code])>1,'Yes',Null())

and change sum(Amount) to if(Count(total <[staff ID], [transaction date]> [cost center code])>1,sum(Amount),Null())

 

and exclude Zero values.

 

If you actually want to create a new field [Entry I am looking for] and not just have it as a calculation in the table, you can add something like this to your script:

 

Join (data)
Load
"transaction date",
"staff ID",
if(count(DISTINCT "cost center code")>1,'Yes','No') as [Entry I am looking for]
Resident data Group By "transaction date","staff ID";

This will give you a field you can filter on.

jbhappysocks_0-1624086447422.png

 

 

 

View solution in original post

2 Replies
jbhappysocks
Creator II
Creator II

Hi!

Based on your example:

if(Count(total <[staff ID], [transaction date]> [cost center code])>1,'Yes','No')

(Entry 6 and 7 are also supposed to be highlighted right?)

jbhappysocks_0-1624084629607.png

If you want to create a table with only the Yes entries, like this:

jbhappysocks_2-1624085032996.png

You change it to if(Count(total <[staff ID], [transaction date]> [cost center code])>1,'Yes',Null())

and change sum(Amount) to if(Count(total <[staff ID], [transaction date]> [cost center code])>1,sum(Amount),Null())

 

and exclude Zero values.

 

If you actually want to create a new field [Entry I am looking for] and not just have it as a calculation in the table, you can add something like this to your script:

 

Join (data)
Load
"transaction date",
"staff ID",
if(count(DISTINCT "cost center code")>1,'Yes','No') as [Entry I am looking for]
Resident data Group By "transaction date","staff ID";

This will give you a field you can filter on.

jbhappysocks_0-1624086447422.png

 

 

 

SL2
Contributor III
Contributor III
Author

Thanks! I just find out if there are multiple records with same [transaction date], same [staff ID], same [cost center code] and that record would also be marked as 'Yes'. To avoid that we can make a slight change:

if(Count(distinct total <[staff ID], [transaction date]> [cost center code])>1,'Yes','No')