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

Cumulatively add multiplied values between two tables

Trying to make a cumulative sum of hours multiplied by Billing Rate. The two columns are linked by the User. There are two hours columns: Approved Hours and Booked Hours.

 

Approved hours should all be in the past (assuming today is 12/10/2022), and booked hours are what we are planning the person will work.

 

What I’m trying to accomplish here is to have a measure (or calculated column) that is a cumulative sum of all the approved hours up until today, and then after that add to those values what the Billing Cost is multiplied by Booked Hours. The purpose of this is to see if the hours in the past push the total amount of cost past the budgeted amount. Think of it like this: when all of the booked hours were loaded, the budget is spot on. If someone worked more than the budgeted hours (which would be logged in the Approved Column), and the future hours (logged in the Booked Column) stayed the same, then the final amount would be over.

 

 

mikesdunbar_0-1674831234685.png

 

 

Hours Report

DateJob codeUserBooked HoursApproved Hours
12/5/2022S - ME Sr. EngineerAllan Tran45
12/5/2022S - ME EngineerBrad Roth61
12/5/2022S - ME EngineerCraig Jones40
12/5/2022S - QA Quality EngineerDustin Kaiser01
12/5/2022S - EE EngineerEd Hayes01
12/5/2022S - PM Project ManagerElaine Light8.629
12/5/2022S - EE Sr. EngineerJessica Miller00
12/5/2022S - EE EngineerJohn Smith00
12/5/2022S - SE EngineerLiz Elliot00
12/5/2022S - SE Sr. EngineerSteve Kent00
12/10/2022S - ME Sr. EngineerAllan Tran30.8240
12/10/2022S - ME EngineerBrad Roth223
12/10/2022S - ME EngineerCraig Jones4.43
12/10/2022S - QA Quality EngineerDustin Kaiser9.891.25
12/10/2022S - EE EngineerEd Hayes2221
12/10/2022S - PM Project ManagerElaine Light10.5316
12/10/2022S - EE Sr. EngineerJessica Miller5.277
12/10/2022S - EE EngineerJohn Smith3632.75
12/10/2022S - SE EngineerLiz Elliot01
12/10/2022S - SE Sr. EngineerSteve Kent5.520
12/17/2022S - ME Sr. EngineerAllan Tran25.2226.5
12/17/2022S - ME EngineerBrad Roth184.5
12/17/2022S - ME EngineerCraig Jones3.613
12/17/2022S - QA Quality EngineerDustin Kaiser8.091.25
12/17/2022S - EE EngineerEd Hayes3023
12/17/2022S - PM Project ManagerElaine Light4.795
12/17/2022S - EE Sr. EngineerJessica Miller4.316.5
12/17/2022S - EE EngineerJohn Smith2625
12/17/2022S - SE EngineerLiz Elliot00.5
12/17/2022S - SE Sr. EngineerSteve Kent4.510
12/24/2022S - ME Sr. EngineerAllan Tran0.180
12/24/2022S - ME EngineerBrad Roth0.130
12/24/2022S - ME EngineerCraig Jones00
12/24/2022S - QA Quality EngineerDustin Kaiser0.060
12/24/2022S - EE EngineerEd Hayes00
12/24/2022S - PM Project ManagerElaine Light0.060
12/24/2022S - EE Sr. EngineerJessica Miller0.030
12/24/2022S - EE EngineerJohn Smith00
12/24/2022S - SE EngineerLiz Elliot00
12/24/2022S - SE Sr. EngineerSteve Kent0.030
12/31/2022S - ME Sr. EngineerAllan Tran18.910
12/31/2022S - ME EngineerBrad Roth13.50
12/31/2022S - ME EngineerCraig Jones9.680
12/31/2022S - QA Quality EngineerDustin Kaiser00
12/31/2022S - EE EngineerEd Hayes220
12/31/2022S - PM Project ManagerElaine Light4.310
12/31/2022S - EE Sr. EngineerJessica Miller3.230
12/31/2022S - EE EngineerJohn Smith25.650
12/31/2022S - SE EngineerLiz Elliot00
12/31/2022S - SE Sr. EngineerSteve Kent3.390
1/7/2023S - ME Sr. EngineerAllan Tran30.820
1/7/2023S - ME EngineerBrad Roth220
1/7/2023S - ME EngineerCraig Jones15.780
1/7/2023S - QA Quality EngineerDustin Kaiser9.890
1/7/2023S - EE EngineerEd Hayes41.80
1/7/2023S - PM Project ManagerElaine Light10.530
1/7/2023S - EE Sr. EngineerJessica Miller5.270
1/7/2023S - EE EngineerJohn Smith41.80
1/7/2023S - SE EngineerLiz Elliot00
1/7/2023S - SE Sr. EngineerSteve Kent5.520

 

Employee Billing Rates

Job CodeBilling Rate (USD)Engineering DisciplineUser
S - EE Engineer180ElectricalJohn Smith
S - EE Engineer180ElectricalEd Hayes
S - EE Sr. Engineer200ElectricalJessica Miller
S - ME Engineer185MechanicalBrad Roth
S - ME Engineer185MechanicalCraig Jones
S - ME Sr. Engineer200MechanicalAllan Tran
S - PM Project Manager190Project ManagerElaine Light
S - PM Project Manager190Project ManagerMike Brooks
S - QA Quality Engineer200QualityDustin Kaiser
S - SE Engineer200SystemsLiz Elliot
S - SE Sr. Engineer275SystemsSteve Kent
1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @mikesdunbar ,

 

Please try:

Measure = 
var _a = MAX('Employee Billing Rates'[Billing Rate (USD)])
var _b = CALCULATE(SUM('Hours Report'[Approved Hours]),FILTER('Hours Report',[Date]<=DATE(2022,12,10)))//assuming today is 12/10/2022, you can replace DATE(2022,12,10) with TODAY() 
var _c = CALCULATE(SUM('Hours Report'[Booked Hours]),FILTER('Hours Report',[Date]>DATE(2022,12,10)))
return _b+_c*_a

Final output:

vjianbolimsft_0-1675059083325.png

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-jianboli-msft
Community Support
Community Support

Hi @mikesdunbar ,

 

Please try:

Measure = 
var _a = MAX('Employee Billing Rates'[Billing Rate (USD)])
var _b = CALCULATE(SUM('Hours Report'[Approved Hours]),FILTER('Hours Report',[Date]<=DATE(2022,12,10)))//assuming today is 12/10/2022, you can replace DATE(2022,12,10) with TODAY() 
var _c = CALCULATE(SUM('Hours Report'[Booked Hours]),FILTER('Hours Report',[Date]>DATE(2022,12,10)))
return _b+_c*_a

Final output:

vjianbolimsft_0-1675059083325.png

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@mikesdunbar , I Hope the Approved hours is a column or a measure in the first table shown in digram on many side

 

Cumm Sales = CALCULATE(SUMC(Table1, Table[Approved hours] * related('Billing Rate'[Billing Rate])) ,filter(all('Date'),'Date'[date] <=max('Date'[date])))

 

Running Total/ Cumulative: https://www.youtube.com/watch?v=h2wsO332LUo&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=41

 

Consider window function

Power BI Window function Rolling, Cumulative/Running Total, WTD, MTD, QTD, YTD, FYTD: https://youtu.be/nxc_IWl-tTc

It's not letting me use that formula. I don't have a specific Date table. Is that why?

mikesdunbar_0-1674836074211.png

If I made a Date Table with Calendar Auto, and join them, I only get values for that week, and only until today. After today, I wanted to switch the summation to the Booked hours. Does that make sense?

 

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.