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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
narangaman
New Member

Calculate cost based on date range and percentage allocation

Hi , I am trying to calculate montly cost spend for a Project (with some employees) from a Program level timesheet data. I have two tables

  • one with timesheet entered each day for the last couple of years by every employee in the program (in hours) each day
  • Other with employee day rate (per day (8 hour day)) between start date and end date and their percentage allocation between those start and end dates.

Table 1 (program level data) Ex

Employee UsernameBilled HoursDate

A

84-jan-23
B64-jan-23
C46-jan-23

A

55-jan-23
B45-jan-23
D24-jan-23
E47-jan-24

F

18-jan-24
A19-jan-24
B67-jan-24

 

Table 2 (project level data)

 

Employee Usernamestart dateend dateday ratepercentage allocation
A1-jan-235-jun-2310050%
A6-jun-2331-dec-23200100%
A1-jan-244-mar-2430060%
B1-jan-235-jun-23100100%
B6-jun-2331-dec-23200100%
C6-jun-2331-dec-2340020%
C1-jan-244-mar-24500

50%

 

I want to create views where i can show cost per month ( for project level ( only A,B and C) employees) 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Here's one way.  In Table 1, write this calculated column formula to bring over the per day rate from Table 2

Per day rate = calculate(sum('Table 2'[day rate]),fiter('Table 2','Table 2'[Employee username]=earlier('Table 1'[Employee Username])&&'Table 2'[Start date]<=earlier('Table 1'[Date])&&'Table 2'[End date]<=earlier('Table 1'[Date])))

Similarly, bring over the percentage allocation column as well.  Effectively, Table 1 is the only relevant table now.  Next, build a Calendar Table with calculated column formulas for Year, Month name and Month number.  Sort the Month name column by the Month number column.  Create a relationship (many to one and single) from the Date column of Table 1 to the Date column of the Calendar Table.  To your visuals/filters/slicers, drag any date dimension from the Calendar Table.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

1 REPLY 1
Ashish_Mathur
Super User
Super User

Hi,

Here's one way.  In Table 1, write this calculated column formula to bring over the per day rate from Table 2

Per day rate = calculate(sum('Table 2'[day rate]),fiter('Table 2','Table 2'[Employee username]=earlier('Table 1'[Employee Username])&&'Table 2'[Start date]<=earlier('Table 1'[Date])&&'Table 2'[End date]<=earlier('Table 1'[Date])))

Similarly, bring over the percentage allocation column as well.  Effectively, Table 1 is the only relevant table now.  Next, build a Calendar Table with calculated column formulas for Year, Month name and Month number.  Sort the Month name column by the Month number column.  Create a relationship (many to one and single) from the Date column of Table 1 to the Date column of the Calendar Table.  To your visuals/filters/slicers, drag any date dimension from the Calendar Table.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors