Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Announcements
Register for Events and Webinars directly from Qlik Community: http://bit.ly/2Vpnenx
Highlighted
ivanoski
New Contributor III

Aggr not returning the count of customers of two months

I am trying to add the customers who purchased in two months

Customers who purchased in january + customers who purchased in february

 

aggr ( Count ( distinct CUSTOMER_ID), (MONTH={'Jan','Feb'}))

 

my ultimate goal is to create an average of customers between those 2 months

 

(Customers who purchased in january + customers who purchased in february )/ 2

 

but the aggr expression returns a different value than my independent calculations 

 

 

 

(Count({<Month={'Jan'}>} distinct CUSTOMER_ID)) + (Count({<Month={'Feb'}>} distinct CUSTOMER_ID)) works but my aggr formula doesnt

 

Labels (3)
1 Solution

Accepted Solutions
Highlighted

Re: Aggr not returning the count of customers of two months

Is your Month field called Month or MONTH? If it is Month, then try this

Sum(Aggr(
    Count(DISTINCT {<Month = {'Jan', 'Feb'}>} CUSTOMER_ID)
, Month))

View solution in original post

4 Replies
Highlighted

Re: Aggr not returning the count of customers of two months

May be this

Sum(Aggr(
    Count(DISTINCT {<MONTH = {'Jan', 'Feb'}>} CUSTOMER_ID)
, MONTH))
ivanoski
New Contributor III

Re: Aggr not returning the count of customers of two months

The result of that formula is zero 😞

Highlighted

Re: Aggr not returning the count of customers of two months

Is your Month field called Month or MONTH? If it is Month, then try this

Sum(Aggr(
    Count(DISTINCT {<Month = {'Jan', 'Feb'}>} CUSTOMER_ID)
, Month))

View solution in original post

Highlighted
ivanoski
New Contributor III

Re: Aggr not returning the count of customers of two months

WOW that one worked, thank you!!!!