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 containing user activity logs for a website.
Each row in the table represents a user visiting a specific page on the website.
I would like to make a new table using DAX to get total (distinct) pages visited per user.
The table below is an example of my activity table:
UserId | PageId |
A | 1 |
A | 2 |
B | 1 |
C | 2 |
C | 1 |
C | 2 |
I would like to get a table that looks like this (C appears 3 times above, but only visited 2 distinct pages):
UserId | NumPages |
A | 2 |
B | 1 |
C | 2 |
I can achieve this in Power Query by using GroupBy twice in a row, but this feels hacky.
You can use
measure = distinctcount(Table[pageID])
In case you want GT to be the sum of lines
sumx(values(table[UserID]),[Measure])
sumx(summarize(table,table[UserID],"_dist",[Measure]),[_dist])
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 |
---|---|
111 | |
94 | |
83 | |
66 | |
59 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |