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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.