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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
tetst3tetsteta1
Frequent Visitor

Group by columns in different tables

I want to calculate a usage rate by sales rep by month which is number of accounts that used a service / number of sales rep's accounts

 

My data looks like

Account table 

AccountIDSales Rep
1David
2David
3David

 

SubAccount (note multiple sub accounts per account)

SubAccountIDAccountID
A1
B1
C2
D3

 

Visits table at the subaccount level

SubAccountIDVisit DateVisitID
A6/2/24123
B6/3/24124
C6/4/24125

-end of table-

 

I want the final table to look like:

Report MonthSales RepNumber of Accounts with a VisitNumber of AccountsUsage Rate
June 2024David2366%
............ 

 

 

David had 3 total visits, but only 2 account ids with a visit and 3 account ids in David's book of accounts. 1 of his accounts had a visit from each subaccount, but that should only be counted once per account.

 

How do I make this?

 

Thank you in advance for your time

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_1-1718431004371.png

 

 

Jihwan_Kim_0-1718430991615.png

 

Number of visit by Account = 
COUNTROWS ( SUMMARIZE ( Visit, Account[AccountID] ) )

 

Number of Account = 
IF ( NOT ISBLANK ( [Number of visit by Account] ), COUNTROWS ( Account ) )

 

usage rate = 
DIVIDE ( [Number of visit by Account], [Number of Account] )

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

View solution in original post

1 REPLY 1
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_1-1718431004371.png

 

 

Jihwan_Kim_0-1718430991615.png

 

Number of visit by Account = 
COUNTROWS ( SUMMARIZE ( Visit, Account[AccountID] ) )

 

Number of Account = 
IF ( NOT ISBLANK ( [Number of visit by Account] ), COUNTROWS ( Account ) )

 

usage rate = 
DIVIDE ( [Number of visit by Account], [Number of Account] )

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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