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
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
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!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.