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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Gusd8
Helper I
Helper I

Get single item with max count per group

Greetings, thank you in advance for looking at this.

I am guessing this is easy to do, but I am just having a brain cramp.

 

I have two tables,
Table 1 ist of reports...so it is Report ID and Report name

Table 2 is a list of Report views...so it is Report ID, User ID and Date

 

My goal is to have an output that has Report ID, User ID, Total Views

 

Where I am having difficulty right now is I want each Report ID to be listed once, the User ID to be the User ID that had the most views for that report and then their total views for that report. (I hope that is clear)

 

The page needs to have a date filter available because they will want to look at the data by week, month and quarter.

 

I am hoping someone can help me with the creation of this visual. Again, Thank You for looking and any insight you have.

1 ACCEPTED SOLUTION
CoreyP
Solution Sage
Solution Sage

This really comes down to modeling. Here's what I've set up and seems to achieve what I understand your requirement to be.

 

My Sample Data:

CoreyP_0-1703210253766.png

 

My model:

CoreyP_1-1703210297477.png

 

DAX measures:

View Count = COUNTROWS( ReportViews )

View Rank = IF( ReportViews[View Count] = 0 , BLANK() , RANKX( ALL( 'dim Users'[UserID] ) , ReportViews[View Count] , , DESC , Skip ) )

 

Output:

CoreyP_2-1703210404826.pngCoreyP_3-1703210430039.png

To only see the user with the most views, I have a filter on the table visual for the rank: 

CoreyP_4-1703210487498.png

 

View solution in original post

1 REPLY 1
CoreyP
Solution Sage
Solution Sage

This really comes down to modeling. Here's what I've set up and seems to achieve what I understand your requirement to be.

 

My Sample Data:

CoreyP_0-1703210253766.png

 

My model:

CoreyP_1-1703210297477.png

 

DAX measures:

View Count = COUNTROWS( ReportViews )

View Rank = IF( ReportViews[View Count] = 0 , BLANK() , RANKX( ALL( 'dim Users'[UserID] ) , ReportViews[View Count] , , DESC , Skip ) )

 

Output:

CoreyP_2-1703210404826.pngCoreyP_3-1703210430039.png

To only see the user with the most views, I have a filter on the table visual for the rank: 

CoreyP_4-1703210487498.png

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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