Forum Discussion

PhilBrookbanks's avatar
PhilBrookbanks
Frequent Visitor
4 years ago
Solved

FTE Calculation with Totals

Hi, I'm hoping somebody can help with the below issue. I've recreated an example in excel as I think this is the easiest way to show.

 

My model has 2 tables. A sales table and a staff HR table containing the number of hours worked and FTE (hours/40).

 

Sales Table

 

User IDDate Sold
Madelaine Hall14/03/2022
Lydia Slade29/03/2022
Amy Humphris20/03/2022
Jo Dews12/03/2022
Robyn Archer25/03/2022
Amanda Hamilton25/03/2022
Lydia Slade05/03/2022
Amy Humphris26/03/2022
Jo Dews06/03/2022
Madelaine Hall25/03/2022
Lydia Slade04/03/2022
Amy Humphris11/03/2022
Jo Dews26/03/2022
Robyn Archer29/03/2022
Amy Humphris28/03/2022
Jo Dews30/03/2022
Robyn Archer05/03/2022
Amanda Hamilton12/03/2022
Lydia Slade13/03/2022

 

Staff Table

 

User IDHoursFTE
Madelaine Hall401
Lydia Slade401
Amy Humphris350.875
Jo Dews200.5
Robyn Archer401
Amanda Hamilton300.75

 

I have a relationship on the staff ID between the 2.

 

I wish to produce a table in Power BI that shows total sales by staff member alongside hours worked and FTE like the below.

 

User IDSalesHoursFTE
Madelaine Hall2401
Lydia Slade4401
Amy Humphris4350.875
Jo Dews4200.5
Robyn Archer3401
Amanda Hamilton2300.75
Total192055.125

 

I'm struggling with the DAX to get the totals for Hours and FTE without them adding up for every sale. e.g. 2 sales and 40 hours becoming 80 hours. Any help would be greatly appreciated.

 

Thanks

Phil

  • PhilBrookbanks I replicated your data at my end and simply joining one to many cardinality based on UserID, I just dragged and dropped the fields from both the table and it's showing me the correct result.

     

     

6 Replies

  • PhilBrookbanks I replicated your data at my end and simply joining one to many cardinality based on UserID, I just dragged and dropped the fields from both the table and it's showing me the correct result.

     

     

    • PhilBrookbanks's avatar
      PhilBrookbanks
      Frequent Visitor

      Worked when I switched the table to use the User ID dimension from the staff table rather than the orders table.

  • PhilBrookbanks , Measures like

    sold = sum(sales[sales])

     

    Total Hours = summarize(Staff , Staff [User ID], Staff[Hour]), [HOUR])

     

    Total FTE= summarize(Staff , Staff [User ID], Staff[FTE]), [FTE])

    • PhilBrookbanks's avatar
      PhilBrookbanks
      Frequent Visitor

      Hi,

      Thank you for your reply, I'm not sure that this solution works as my staff table is already a dimension table with unique entries I already essentially have it summarised by staff id and hours. my issue is that when looking at data from the fact table (sales) it is summing up the assocated hours and therefore the total in the table becomes a sumproduct. I need the measure to not sum in the table and then the total to be the sum of these.