Power BI中创建累计客户激活占比统计表格的方法咨询
Power BI 客户激活率统计实现方案
原始数据结构
原始客户表包含以下列:
- ID:客户唯一标识
- Days since Registration:客户注册至今的天数
- Days to Activity:客户从注册到激活的天数,未激活则为NULL
样例数据
| ID | Days since Registration | Days to Activity |
|---|---|---|
| 11 | 2 | 1 |
| 22 | 3 | NULL |
| 33 | 4 | 3 |
| 44 | 4 | 4 |
| 55 | 2 | 1 |
| 66 | 1 | NULL |
| 77 | 3 | 3 |
| 88 | 4 | 2 |
需求描述
需创建统计表格,展示每个注册天数Day对应的三个核心指标:
- Customers registered:注册天数≥当前Day的客户总数
- Active customers:注册天数≥Day,且激活天数≤Day的客户总数
- % active:激活客户数占符合条件注册客户数的比例
目标统计表格
| Day | Customers registered | Active customers | % active |
|---|---|---|---|
| 1 | 8 | 2 | 25% |
| 2 | 7 | 3 | 43% |
| 3 | 5 | 3 | 60% |
| 4 | 3 | 3 | 100% |
实现步骤
1. 创建天数维度表
首先生成包含所有需统计天数的独立维度表(覆盖从1到原始表中最大注册天数的连续值),使用DAX公式创建:
Days Table = GENERATESERIES(1, MAX('Customer Table'[Days since Registration]), 1)
该表仅需一列Day,用于作为统计的行标签。
2. 创建核心度量值
假设原始客户表名为Customer Table,创建以下三个度量值:
(1)Customers registered
Customers registered = CALCULATE( DISTINCTCOUNT('Customer Table'[ID]), FILTER( ALL('Customer Table'), 'Customer Table'[Days since Registration] >= SELECTEDVALUE('Days Table'[Day]) ) )
(2)Active customers
Active customers = CALCULATE( DISTINCTCOUNT('Customer Table'[ID]), FILTER( ALL('Customer Table'), 'Customer Table'[Days since Registration] >= SELECTEDVALUE('Days Table'[Day]) && NOT(ISBLANK('Customer Table'[Days to Activity])) && 'Customer Table'[Days to Activity] <= SELECTEDVALUE('Days Table'[Day]) ) )
(3)% active
% active = DIVIDE( [Active customers], [Customers registered], 0 )
创建后可将该度量值的格式设置为百分比。
3. 构建可视化表格
将Days Table中的Day列拖至表格的行区域,再依次添加三个度量值到值区域,即可得到目标统计表格。
内容的提问来源于stack exchange,提问作者Yuval Harris
相关产品推荐
相关产品推荐

