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.
I have a table in below format and want to find the % of how many players change from value true to false in camera_enabled based on the timestamp and session_id per single player_id.
Player_ID | Session_ID | Camera_enabled | Timestamp |
1 | aaaa | True | 1:00 PM |
1 | bbbb | True | 3:00PM |
1 | bbbb | True | 4:00 PM |
1 | aaaa | False | 2:00PM |
2 | aaaa | True | 1:30 PM |
2 | aaaa | False | 2:00 PM |
3 | cccc | False | 1:00 PM |
3 | cccc | False | 2:00 PM |
To summarize: 3 unique users... in 3 unique sessions... 1 player paticipated in 2 different sessions... 2 of the 4 pairings have changed state from true to false per player_id per session_id
Desired outcome: 50% of the above player_ids per session have changed camera_enabled status from True to False
Solved! Go to Solution.
Hi @BrandonL
Kindly check below results:
Column = [Player_ID]&"_"&[Session_ID]
Measure = var a = CALCULATE(DISTINCTCOUNT('Table'[Camera_enabled]),ALLEXCEPT('Table','Table'[Player_ID],'Table'[Session_ID],'Table'[Column]))
Return
IF(a>1,1,BLANK())
Measure 2 = var a = CALCULATE(DISTINCTCOUNT('Table'[Column]),FILTER('Table',[Measure]<>BLANK()))
var b = DISTINCTCOUNT('Table'[Column])
Return
DIVIDE(a,b)
Pbix attached for your ease.
Hi @BrandonL
Kindly check below results:
Column = [Player_ID]&"_"&[Session_ID]
Measure = var a = CALCULATE(DISTINCTCOUNT('Table'[Camera_enabled]),ALLEXCEPT('Table','Table'[Player_ID],'Table'[Session_ID],'Table'[Column]))
Return
IF(a>1,1,BLANK())
Measure 2 = var a = CALCULATE(DISTINCTCOUNT('Table'[Column]),FILTER('Table',[Measure]<>BLANK()))
var b = DISTINCTCOUNT('Table'[Column])
Return
DIVIDE(a,b)
Pbix attached for your ease.
Hi @BrandonL
Kindly let me know if you'd like to get the below results:
Player1 and Player2 changed value from true to false per session, so the final output should be 2/3=0.67. right?
Measure = var a = CALCULATE(DISTINCTCOUNT('Table'[Camera_enabled]),ALLEXCEPT('Table','Table'[Player_ID],'Table'[Session_ID]))
Return
IF(a>1,1,BLANK())
Measure 2 = var a = CALCULATE(DISTINCTCOUNT('Table'[Player_ID]),FILTER('Table',[Measure]<>BLANK()))
var b = DISTINCTCOUNT('Table'[Player_ID])
Return
DIVIDE(a,b)
Pbix attached.
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 |
---|---|
110 | |
94 | |
82 | |
66 | |
58 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |