Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Analysis Sum Distinct

I am trying to sum the difference between two date values for unique combinations of Name, Date1, and Date2

I have data of the format:

NameDate1Date2

Chuck

1/1/121/3/12
Sam1/1/121/3/12
Sam

1/3/12

1/5/12

Sam

1/3/121/5/12
Sam1/3/121/5/12

And I want to sum Date2 - Date1 for unique combinations. In this case, Chuck would get 2, the first line of Sam would get 2, and the next 3 lines of Sam are all identical so would count once and be 2 for a total of 6.

Currently all I can get is 2+2+2+2+2=10

Anybody know how to code this?

3 Replies
swuehl
MVP
MVP

Maybe like

=sum( aggr( Date2-Date1, Name, Date2, Date1))

maxgro
MVP
MVP

swuehl,

perhaps the aggr with nodistinct?

Not applicable
Author

Worked great, and my coworker thought I was a genius for coding it this way!