Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
mikesdunbar
Frequent Visitor

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 

1 ACCEPTED SOLUTION

Try with this measure:

 

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

 

Uspace87_0-1668677068006.png

 

View solution in original post

5 REPLIES 5
CNENFRNL
Community Champion
Community Champion

CNENFRNL_0-1668628856669.png

 


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Uspace87
Resolver III
Resolver III

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])

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

 

Try with this measure:

 

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

 

Uspace87_0-1668677068006.png

 

That did it, thank you!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.