Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi Guys - I hope you are all well !
I have a conundrum, and would appreciate your guidance 🙂
I have an events table, as per the following example.
Date | UserGuid | Action |
1/26/2021 | <unique guid> | REGISTER |
1/26/2021 | <unique guid> | LOGIN |
1/26/2021 | <unique guid> | LOGIN |
1/26/2021 | <unique guid> | REGISTER |
I need to generate a user retention graph showing those who continue to login after 1 day, 7 days, and 20 days (and potentially other days).
So I need to work out for each user;
This would then be shown in an aggregated manner, so what % of all users log in after 1 day, 7 days and so on.
I would very much appreciate any guidance!
Thanks all
Kevin
Solved! Go to Solution.
Hi @ksfx77 ,
According to my understanding, you want to set a flag for each User based on the date diff between the first register date and the first login date, and then calculate the percentage of all records, right?
You could use the following formula to create a calculated table :
Table 2 =
ADDCOLUMNS (
DISTINCT ( 'Table'[UserGuid] ),
"Flag",
VAR _regiDate =
CALCULATE (
MAX ( 'Table'[Date] ),
FILTER (
ALLEXCEPT ( 'Table', 'Table'[UserGuid] ),
'Table'[Action] = "REGISTER"
)
)
VAR _firstLogin =
CALCULATE (
MIN ( 'Table'[Date] ),
FILTER ( ALLEXCEPT ( 'Table', 'Table'[UserGuid] ), 'Table'[Action] = "Login" )
)
VAR _datediff =
DATEDIFF ( _regiDate, _firstLogin, DAY )
RETURN
IF (
_datediff >= 30,
"30 Days",
IF ( _datediff >= 7, "7 Days", IF ( _datediff >= 0, "1 Days" ) )
)
)
Then directly create a line visual with Flag column like this:
Or create a Percentage column for table visual:
Percentage =
CALCULATE (
COUNT ( 'Table 2'[Flag] ),
ALLEXCEPT ( 'Table 2', 'Table 2'[Flag] )
)
/ COUNTROWS ( 'Table 2' )
Please take a look at the pbi file here.
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @ksfx77 ,
According to my understanding, you want to set a flag for each User based on the date diff between the first register date and the first login date, and then calculate the percentage of all records, right?
You could use the following formula to create a calculated table :
Table 2 =
ADDCOLUMNS (
DISTINCT ( 'Table'[UserGuid] ),
"Flag",
VAR _regiDate =
CALCULATE (
MAX ( 'Table'[Date] ),
FILTER (
ALLEXCEPT ( 'Table', 'Table'[UserGuid] ),
'Table'[Action] = "REGISTER"
)
)
VAR _firstLogin =
CALCULATE (
MIN ( 'Table'[Date] ),
FILTER ( ALLEXCEPT ( 'Table', 'Table'[UserGuid] ), 'Table'[Action] = "Login" )
)
VAR _datediff =
DATEDIFF ( _regiDate, _firstLogin, DAY )
RETURN
IF (
_datediff >= 30,
"30 Days",
IF ( _datediff >= 7, "7 Days", IF ( _datediff >= 0, "1 Days" ) )
)
)
Then directly create a line visual with Flag column like this:
Or create a Percentage column for table visual:
Percentage =
CALCULATE (
COUNT ( 'Table 2'[Flag] ),
ALLEXCEPT ( 'Table 2', 'Table 2'[Flag] )
)
/ COUNTROWS ( 'Table 2' )
Please take a look at the pbi file here.
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
please provide more representative sample data, with real fake user ids, and sufficient time range.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
97 | |
84 | |
67 | |
61 |
User | Count |
---|---|
150 | |
120 | |
99 | |
87 | |
68 |