Scatter Chart - Calculate total % contribution for top 10 dates/customers
I am trying to build a scatter chart that will show me the relation between 'total % of sales for top 10 dates' and 'total % of sales for top 10 customers'. My example data is as below:
SalesDate
Product
Customer
Sales
15/01/2015
A
1
50000
23/02/2015
A
2
25000
30/02/2015
B
3
5000
05/03/2015
C
3
100000
12/03/2015
B
1
20000
30/03/2015
D
5
453246
04/04/2015
C
1
576556
07/05/2015
D
3
242364
What I need to calculate is as follows: total % of sales for top 10 dates - calculate %contribution of sales done on top 10 sales date to the overall sales for a given product
total % of sales for top 10 customers - calculate % contribution of sales done with top 10 customers to the overall sales for a given product.
For this I believe my scatter chart dimension must be Product?
I am having difficulties calculating my X and Y field. I am currently using below expressions for X and Y field:
X : sum(aggr(if(rank(aggr(sum(Sales),SalesDate)/sum(TOTAL Sales))<=10,aggr(sum(Sales),SalesDate)/sum(TOTAL Sales)),SalesDate))
However, this doesn't work for me. Moreover, I have the Sales date across years and would like to see the above % contribution for a given year (to the overall sales for the same year). Please advise.