Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Folks,
Looking for help. Can you give some insight to provide Top 3 customers by sales plus top 3 customers by product count.
Appreciate your time and help.
On the script side you can try
Step1:
Load
Cust,
Sum(Sales) as Sales_Cust
Resident Sales
Group By
Cust
;
Left Join(Sales)
First 3 Load
Cust,
RowNo() as Cust_Rank
Resident Step1
Order by
Sales_Cust Desc
;
Drop Table Step1;
Step1:
Load
Cust,
Sum(Prod_Count) as Cust_Prod_Count
Resident Sales
Group By
Cust
;
Left Join(Sales)
First 3 Load
Cust,
RowNo() as Cust_ProdCount_Rank
Resident Step1
Order by
Cust_Prod_Count Desc
;
Drop Table Step1;
If you want this on the front end use
Note: If two customers have same sales or same product count then they would be ranked based on load order.
One solution in frontend.
=Concat({<Customer={"=Rank(Sum(Sum_SalesAmount))<=3"}>}Customer,', ')
=Concat({<Customer={"=Rank(Sum(Sum_Product_Count))<=3"}>}Customer,', ')