My data set (Google Sheets) is:
| user_email | current_step |
|---|---|
| user1@example.com | 1 |
| user1@example.com | 1 |
| user2@example.com | 1 |
| user3@example.com | 1 |
| user3@example.com | 0 |
| user4@example.com | 0 |
I want to take the number of instances that meet a criteria, i.e. COUNT_DISTINCT(current_step = 1), and divide that result by the total number of users in my data set, i.e. COUNT_DISTINCT(user_email).
For reference in case it helps, the Excel equivalent (assuming user_email in Column A, current_step in Column B):
=COUNTIF(B2:B,1)/COUNTA(A2:A)
The expected output (Google Sheets) would be 4/6 = 0.67 (67%):
| user_email | current_step | COUNTIF(B2:B,1) | COUNTA(A2:A) |
|---|---|---|---|
| user1@example.com | 1 | 1 | 1 |
| user1@example.com | 1 | 1 | 1 |
| user2@example.com | 1 | 1 | 1 |
| user3@example.com | 1 | 1 | 1 |
| user3@example.com | 0 | 0 | 1 |
| user4@example.com | 0 | 0 | 1 |
Google Data Studio report
