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
CarlsBerg999
Helper V
Helper V

Using slicer to select a related value

Hi,

 

I have a table with Employee names and Jobs:

 

Employee NameJob
ToddAnalyst
FrankController
JessieAnalyst

 

Another table has Employee Names and total hours:

 

Employee NameJobHours
ToddAnalyst4
ToddAnalyst6
FrankController4
FrankController9
JessieAnalyst3

 

There is a One-to-Many relationship between employee masterdata and the total hours data table. I want to create a filter that sums the hours for all Analysts when i click on Jessie's name on a slicer. What i've been trying is this:

 

Peer Group Logged Hours = CALCULATE(
SUM('Table2'[Hours]),
FILTER('Table2','Table2'[Job]=LOOKUPVALUE('Table1'[Job],'Table1'[Employee],SELECTEDVALUE('Table1'[Employee]))))
 
However, this does not work. 
 
What does work however, is

Peer Group Logged Hours = CALCULATE(
SUM('Table2'[Hours]),
FILTER('Table2','Table2'[Job]=LOOKUPVALUE('Table1'[Job],'Table1'[Employee],"Jessie")))

 

What am i doing wrong

2 REPLIES 2
v-xiaotang
Community Support
Community Support

Hi @CarlsBerg999 

Try this.

Measure =
  var _job=SELECTEDVALUE(Table1[Job])
return
  CALCULATE(SUM(Table2[Hours]),FILTER(ALL(Table2),Table2[Job]=_job))

Result:

v-xiaotang_0-1620883508718.png

Or if you want to modify the original measure, you can use function ALL().

Peer Group Logged Hours = CALCULATE(
SUM('Table2'[Hours]),
FILTER(ALL('Table2'),'Table2'[Job]=LOOKUPVALUE('Table1'[Job],'Table1'[Employee Name],"Jessie")))

Result:

v-xiaotang_1-1620883508720.png

 

Best Regards,

Community Support Team _ Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hello @CarlsBerg999 ,

I am not sure how would you like to display the results.

But you can try with below measure,

Measure = CALCULATE(SUM(Table2[Hours]),FILTER(Table2,Table2[Job]="Analyst"&&Table2[Employee Name]="Jessie"))

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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.