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

aggr function min Date group by

Hi,

i have some trouble to find the right solution. i´m struggling around for a while with this issue.

let´s say i have following table:

weektype_iduser_id
111
122
133
211
222
234

Now i want to count all distinct "type_ids" with at least one new "user_id" for given week.

Solution should look like this:

with dimension "week"

weekcount type_ids with at least 1 new user_id
13
21

for week 1 there are 3 new user_ids

for week 2 only 1 new user_id (user_id = 4). the other user_ids (1,2,3) had already been in week 1, so they should not be counted in week 2.

Hope it´s clear what i´m trying to achieve.

Thanks for help.

regards

Steve

2 Replies
Not applicable
Author

I think i found the solution by myself:

Count(Distinct If(Aggr(NODISTINCT Min(Date), user_id) = Date, type_id))

anbu1984
Master III
Master III

If you have same type_id for different user_ids, then to get correct result, try like this

Count(Distinct If(Aggr(NODISTINCT Min(Date), user_id) = Date, user_id))