数据源:Tableau官方数据源:Sample - Superstore
1、不同购买频次的客户分布
- Tableau实现
(1)聚合Customer ID(fixed函数)统计不同订单数量(countd函数)
{ FIXED [Customer Name]:COUNTD([Order ID])}
(2)将聚合结果作为维度列,再次统计不同Customer ID数量
-
M****ySQL实现
(1)聚合customerid统计不同orderid,将结果视图表作为子查询表
(2)聚合不同orderid统计结果,统计customerid数量
select b.频次,count(b.customerid) as 客户数量 from (select c.customerid,count(distinct c.orderid) as 频次 from orders c group by c.customerid) b group by b.频次 order by b.频次 asc;
2、不同地区市场,各年度、