Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Getting a total based on the possible values from field selection

Hi there,

My data model has basically 4 things, a customer, a purchase date, product, and sale amount.

My table is like this:

CustDateProductAmount
John1/5/2016Apple$2
John1/6/2016Banana$3
John1/6/2016Banana$2
John1/7/2016Orange$5
James1/6/2016Apple$1
James1/6/2016Banana$3
James1/7/2016Banana$3
Jenny1/5/2016Banana$3
Jenny1/6/2016Apple$6
Jenny1/7/2016Orange$2

I want to be able to get the total of whoever bought Apples but only on the date they bought the Apple.

If I select Apple in the field selection, I want to be able to get John's total on 1/5/2016, James total on 1/6/2016, and Jenny's total on 1/6/2016, coming out to be $12.

Is there a way to do this?

Thank you.

1 Solution

Accepted Solutions
Not applicable
Author

How about like this?

View solution in original post

9 Replies
Not applicable
Author

Thank you for your response.

I believe I might have been a little confusing. The totals that I want for the output is the sum of all the products of the specific date according to when the apple was purchased.

Since John purchased the apple on 1/5/2016, I want to know his total on that day which is $2. James' total would be $4 since he purchased the apple on 1/6/2016 and Jenny's would be $6. Grand total of the apple selection would be $12.

I was wondering if there was a way to do this. Thanks again

damirm86
Partner - Contributor III
Partner - Contributor III

Something like this maybe?

sunny_talwar

For single purchase, this formula seems to be working:

=Sum({<Product>}Aggr(If(Only({<Product>}Date) = Only(TOTAL <Cust> Date), Only({<Product>}Amount)), Cust, Date, Product))

Works for Apple, but doesn't work for Banana. What would be the output for selection in Banana?

Not applicable
Author

How about like this?

sunny_talwar

Looks good

effinty2112
Master
Master

Hi Ming,

What about :

Date Cust Sum(Aggr(If(index(aggr(Concat(Product,'|'),Cust,Date),'Apple'),Sum(Amount)),Cust,Date))
12
1/5/2016John2
1/6/2016James4
1/6/2016Jenny6
Not applicable
Author

Thanks, Sunny!  Learned only() from you.

Not applicable
Author

It shows the total for the product. I still need the date total based on the product selection if you can help. Thanks

Not applicable
Author

Wow! This is exactly what I'm looking for. Thank you all your help. Much appreciated.