cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
timneo Frequent Visitor
Frequent Visitor

Looking up rates

I have three tables

Rates:

Rate ID, Rate, Per Hour
1, A, 10
2, B, 20
3, C, 30

 

Staff 

Staff ID, Name, Rate
1, Bob, A
2, Fred, B
3, Shelly, C
4, George, C

 

Timesheet 

Timesheet ID, Staff ID, Hours
1, 1, 30
2, 2, 30
3, 2, 30
4, 1, 60
5, 3, 30
6, 4, 60


I am using  

 

Total Hours worked = Calculate(SUM(Timesheet[Hours]),Filter(all('Timesheet'),'Timesheet'[Staff ID]=Staff[Staff ID]))

 

To look up my hours and total them

 

I'm trying to lookup the rates from the rate table

 

Rate Per Hr = LOOKUPVALUE(Rates[ Per Hour],Rates[Rates],Staff[Rate])

 

But I get an error about single values.  Not sure what I'm doing wrong on this one!  Any help?  I've been using PowerBI for about two days and not really done a lot of DAX.

 

Frankly, I don't need to replicate the data in the table from Rates, just do the calculation which is total hous worked * hourly rate 

1 ACCEPTED SOLUTION

Accepted Solutions
timneo Frequent Visitor
Frequent Visitor

Re: Looking up rates

Gah

 

Measure = sumx('Staff','Staff'[Total Hours worked] * RELATED('Rates'[ Per Hour]))

 

1 REPLY 1
timneo Frequent Visitor
Frequent Visitor

Re: Looking up rates

Gah

 

Measure = sumx('Staff','Staff'[Total Hours worked] * RELATED('Rates'[ Per Hour]))