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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Aggr doesn't work with computed dimensions, so how do I do aggr(count(x), Date(timestamp))?

Let's say, I need to find the avg number of distinct buyers per day so it should be, theoretically, something like this:

avg( aggr( count(distinct buyer_id), date(purchase_time) ) )

but this doesn't work because aggr() can't take computed dimension, I.E - date(purchase_timestamp).

What is the best solution for this?

Thanks in advance.

1 Solution

Accepted Solutions
mdmukramali
Specialist III
Specialist III

Dear,

can you try to create a field in the script level.

date(purchase_time) as Purchase_Date

then

avg( aggr( count(distinct buyer_id), Purchase_Date) )

hope it will work.

Thanks,

Mukram

View solution in original post

2 Replies
mdmukramali
Specialist III
Specialist III

Dear,

can you try to create a field in the script level.

date(purchase_time) as Purchase_Date

then

avg( aggr( count(distinct buyer_id), Purchase_Date) )

hope it will work.

Thanks,

Mukram

Not applicable
Author

I was hoping to find a solution that does not involve without having to redefine the model but I guess there is none.

Thanks!