Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
jamesleslie
Advocate I
Advocate I

How to get distinct pages visited per user

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: 

 

UserIdPageId
A1
A2
B1
C2
C1
C2


I would like to get a table that looks like this (C appears 3 times above, but only visited 2 distinct pages):

UserIdNumPages
A2
B1
C2


I can achieve this in Power Query by using GroupBy twice in a row, but this feels hacky.

1 REPLY 1
amitchandak
Super User
Super User

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])

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.