1.计算日期对比
1.1 创建2个日期表,

日期表 = 
ADDCOLUMNS (
CALENDARAUTO( ),
"年度", YEAR ( [Date] ),
"季度", "Q" & FORMAT ( [Date], "Q" ),
"月份", FORMAT ( [Date], "MM" ),
"日",FORMAT ( [Date], "DD" ),
"年度季度", FORMAT ( [Date], "YYYY" ) & "Q" & FORMAT ( [Date], "Q" ),
"年度月份", FORMAT ( [Date], "YYYY/MM" ),
"星期几", WEEKDAY ( [Date],2 )
)

比较日期表 = '日期表'

1.2
日期表关联业务日期,比较日期表关联日期表虚线

1.3创建度量值

对比UV = 
VAR compareperiod=
CALCULATETABLE(
VALUES('日期表'[Date]),
REMOVEFILTERS('日期表'),
USERELATIONSHIP('日期表'[Date],'比较日期表'[Date]))
RETURN 
CALCULATE(DISTINCTCOUNT([uv]),compareperiod)

2.维度选择
2.1创建维度表

维度表 = DATATABLE("index_id",INTEGER,"维度",STRING,{{1,"日新增用户数"},{2,"日活跃用户数"},{3,"日启动次数"}})

2.2 创建度量值

维度切换 = IF(HASONEVALUE('维度表'[维度]),SWITCH(VALUES('维度表'[维度]),"日新增用户数",sum([new_users]),"日活跃用户数",sum([activity_users]),"日启动次数",sum([launches]),BLANK()),sum([activity_users]))

2.3 新增筛选器改变样式
image.png
image.png

相关函数参考
https://zhuanlan.zhihu.com/p/35982521
https://edwindataanalyst.wordpress.com/2019/05/18/power-bi-da...


s8fh26h3
18 声望1 粉丝

引用和评论

0 条评论