首页 文章

Power bi - 用户保留率计算

提问于
浏览
0

我是Power bi的新手,几乎所有的论坛都尝试过搜索,但找不到与我相似的东西 .

那么..我有一个像下面这样的表(类似的东西)

enter image description here

我想计算用户(实际回来的人)的保留率 .

到目前为止我做了什么:

RetentionRate =(ReturningUsers / PreviousDayDistinctUsers)* 100%ReturningUsers = DistinctUsers - NewUsers PreviousDayDistinctUsers = CALCULATE(DISTINCTCOUNT(table [User],PREVIOUSDAY(table [Date])NewUsers = CALCULATE(DISTINCTCOUNT(table [User]),table [MonthlyNewUsers] = BLANK())

上面看起来是有效的,但唯一的缺点是 PreviousDayDistinctUsers ,因为它只考虑前一天(不是从开始到那天的所有日子) .

那我怎么写一个 measure to calculate the DistinctUsers for all the days until today

1 回答

  • 1
    PreviousDayDistinctUsers =
       VAR Current_Day = LASTDATE ( table[Date] )
       RETURN 
        CALCULATE ( DISTINCTCOUNT ( table[User] ), table[Date] < Current_Day )
    

    工作原理:首先,将过滤器上下文中的最后日期保存到变量中(而不是LASTDATE,您也可以使用MAX函数) . 其次,过滤表用户按小于保存日期的所有日期,并计算过滤表中的不同用户 .

相关问题