Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
ivanoski
Contributor III
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
sunny_talwar

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
sunny_talwar

May be this

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

The result of that formula is zero 😞

sunny_talwar

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))
ivanoski
Contributor III
Contributor III
Author

WOW that one worked, thank you!!!!