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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Dynamically filter a table to perform benchmarking

Hi all. I've been stewing on this all day and can't figure it out. I have two tables: 

 

1) A list of salesperson names and office locations:   

 

Salesperson in Table 1 has an established one:many relationship with Salesperson in Table 2, and Table 1 is set to filter Table 2

 

USERS TABLE

SalespersonOfficeRegion
Jon SnowWallNorth
Cersei LannisterWesterosMid
Sansa StarkWinterfellNorth
Samwell TarlyWallNorth

 

2) A list of salesperson names, customer names, offices, and sales amounts:

 

SALES TABLE

SalespersonCustomerSaleOffice
Jon SnowB$4,500Wall
Jon SnowC$5,000Wall
Jon SnowB$650Wall
Jon SnowB$500Wall
Sansa StarkD$67,000Winterfell
Sansa StarkD$1,200Winterfell
Sansa StarkD$17,000Winterfell
Sansa StarkE$12Winterfell
Samwell TarlyF$100,000Wall
Samwell TarlyF$99,000Wall
Cersei LannisterG$17Westeros

 


I have a report where the user selects a salesperson from the slicer, and we show the sales amount across customers for that salesperson. Pretty standard stuff. 

 

What I also want to do is to show the sales amount for other employees with the same office location or region, as a benchmark. So you'd see something like the table below, where you can see that Jon Snow has lower-than-average sales as compared to other salespeople at the Wall or in the North. 

 

SalespersonTotal SalesAverage Sales
Jon Snow$10,650$2,662
Wall salespeople$209,650$34,941
North salespeople$294,862$29,486

 

I'm pretty sure my answer lies in a Calculated table, but whenever I build one, I end up with all the expected columns, except they're empty. 

 

I've been using variations of the below measure to create the virtual table, but no matter what I try, I get sales = blank. Thank you in advance for any help you can provide!

DRAFT Table =
var _selectedvalue =CALCULATE( SELECTEDVALUE(Users[Office]),
         USERELATIONSHIP(Users[Salesperson],Sales[Salesperson]))

return        
 CALCULATETABLE(
    'Sales',
    'Sales'[Office] =_selectedvalue
     )
1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , try measure like

 

Measure =
var _office = Summarize(allselected(Table1), Table1[Office])
var _Region = Summarize(allselected(Table1), Table1[Region])
return
calculate(averageX(Values(Table1[Salesperson]), calculate(Sum(Table2[Sale]))), filter(all(Table1),Table1[Office] in _office && Table1[Region] in _Region))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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