DAX formula for calculated field from multiple tables

lochem

New Member
Joined
Jun 14, 2010
Messages
28
hi there everyone,

i am struggling with the following task in PowerPivot/Powerview for excel2013 (see tables below) :

Table A: "Jobs Data" has information on "Production Jobs" - each row has a unique job ID number.
Table B: "Direct Labor Data" has records with information about "direct labor" hours required for each Job on different days, and how many units were completed by laborers in each time block.
Table C: "Indirect Labor Data" has records on "indirect labor" hours required on different days per Job.

The task is to calculate "Units Per Hour" by dividing units completed/(direct labor+indirect labor) as follows (in pseudo code - assuming i am creating the calculated field in the Direct Labor table):

Code:
Units Per Hour = Direct Labor[Units Completed] / (Direct Labor[direct manhours] + Indirect Labor[Indirect manhours])

i have tried a few ways to do this and i am getting either errors or incorrect measures!

anyone know how i can combine these 2 fields from different tables properly??

Jobs Data: (defined here for relationship purposes between tables B and C):

Job IDCustomer IDEtc.
Job 1
customer 3
Job 2customer 6

<tbody>
</tbody>

Direct Labor:

DateJob IDWorkstationStart TimeEnd Time# of pplDirect ManhoursUnits Completed
3-febJob 1station a...=(end time - start time) * (# of ppl)5
4 febJob 1station b...23
4febJob 2station x...12
5-febJob 2station y...17

<tbody>
</tbody>

Indirect Labor:
DateJob IDIndirect Taskstart timeend time# of pplIndirect Manhours
3 febJob 2task a...calculated same as above
4 FebJob 1task x...
5 febJob 2task y...
3 febJob 1task a...

<tbody>
</tbody>
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
I think as long as you have the proper relationships (with both indirect and direct labor referencing back to the jobs data table, and using the jobs data job id column as the row labels on your pivot table) all you are missing is the aggregation of the data related to the jobs on the data tables, so:

sum('Direct Labor'[Units Completed])/(sum('Direct Labor'[Direct Manhours])+sum('Indirect Labor'[Indirect Manhours]))
 
Upvote 0
I think as long as you have the proper relationships (with both indirect and direct labor referencing back to the jobs data table, and using the jobs data job id column as the row labels on your pivot table) all you are missing is the aggregation of the data related to the jobs on the data tables, so:

sum('Direct Labor'[Units Completed])/(sum('Direct Labor'[Direct Manhours])+sum('Indirect Labor'[Indirect Manhours]))

sigh... oh dear me. i realized my mistake before even really reading your response.

indeed, the Job ID wasnt being taken from the parent table Job Info. .... ive changed that and indeed it seems to be OK.

thanks...:p
 
Upvote 0

Forum statistics

Threads
1,215,327
Messages
6,124,287
Members
449,149
Latest member
mwdbActuary

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top