Forum Discussion

mikesdunbar's avatar
mikesdunbar
Helper I
3 years ago
Solved

Weekly billing amounts

Hello,

I'm trying to calculate the weekly billing amounts for individuals based on their job title. There are two spreadsheets that cover this.

 

First spreadsheet

Includes Job Code and Rate

 

Job CodeBilling Rate (USD)
Electrical125
Mechanical150
Project Manager140
Systems160
Director190

 

Second spreadsheet

Has date (considered the start of a 7 day week), name, Job Code and hours worked

 

DateJob CodeNameHours worked
9/10/2022ElectricalEdward15
9/17/2022MechanicalMike10
9/24/2022Project ManagerPaul20
10/1/2022SystemsStephanie5
10/8/2022DirectorDonna10
10/15/2022ElectricalEdward5
10/22/2022MechanicalMike20
10/29/2022Project ManagerPaul20
11/12/2022DirectorDonna5

 

I'm trying to create a measure that would display in a matrix their hours worked and amount billed for that week.

DateNameHours workedAmount Billed
9/10/2022Edward15$1,875
9/17/2022Mike10$1,500
9/24/2022Paul20$2,800
10/1/2022Stephanie5$800
10/8/2022Donna10$1,900
10/15/2022Edward5$625
10/22/2022Mike20$3,000
10/29/2022Paul20$2,800
11/12/2022Donna5$950

 

I'd like to keep the two spreadsheets separate since Billing Rates change, and the Hours Worked is exported from something else. 

 

Thanks!
Mike 

  • Uspace87's avatar
    Uspace87
    3 years ago

    Try with this measure:

     

    Amt billed = Sumx(NATURALINNERJOIN(Table1,Table2), 'Billing Rate'[Billing Rate (USD)]*'Hours Worked'[Hours worked])

     

     

5 Replies

  • Hi,

     

    Once you connect the two tables in your data model using the "Job Code" you can just write the following:

     

    Amount Billed = Sum(First_Spreedsheet[Billing Rate (USD)]*Sum(Second_Spreedsheet[Hours worked])

    • mikesdunbar's avatar
      mikesdunbar
      Helper I

      So that's the equation that I started with, but it gives me a response way more than what it should be. Here's what it should be and what PowerBI calcultes.

       

      DateJob CodeNameHours workedBilling Rate (USD)What it should beWhat Power BI calcs
      9/10/2022ElectricalEdward15125       1,875          11,475
      9/17/2022MechanicalMike10150       1,500            7,650
      9/24/2022Project ManagerPaul20140       2,800          15,300
      10/1/2022SystemsStephanie5160          800            3,825
      10/8/2022DirectorDonna10190       1,900            7,650
      10/15/2022ElectricalEdward5125          625            3,825
      10/22/2022MechanicalMike20150       3,000          15,300
      10/29/2022Project ManagerPaul20140       2,800          15,300
      11/12/2022DirectorDonna5190          950            3,825

       

      • Uspace87's avatar
        Uspace87
        Resolver III

        Try with this measure:

         

        Amt billed = Sumx(NATURALINNERJOIN(Table1,Table2), 'Billing Rate'[Billing Rate (USD)]*'Hours Worked'[Hours worked])