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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Summing based on criteria from another table?

I have a date table that has a row for each employee and another table with due dates by employee. I would like to compare each date/ employee row to the due dates table and sum the effort value for each due date for that employee that is greater than or equal the date being looked up. I'm having trouble trying to find the correct way to set this up in query editor. I have included pictures of the desired outcome below.

 

 

Inputs:

Due Date TableDue Date Table

Date TableDate Table

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Outcome:

OutcomeOutcome     

 

Thanks!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Ok so I figured this out after doing some research. Going to post my solution here because I hate going to forums and seeing "nvm figured it out - posted Nov. 2009".

 

I modified the code from this post.

Shoutout to @Greg_Deckler  for figuring this out.

 

My Solution:

  1. Combine the calendar table with a unique employee name table (not pictured in my original question, it's just a list of distinct employee names)
  2. Add on effort to this table, matching the due date and employee combination to the respective row in the combined employee calendar table.
  3. Create a custom column with the following code:

 

Remaining Effort =
// Get the current day and employee for the current row of the calendar table
VAR __day = 'Employee Calendar Combined'[date]
VAR _employee = 'Employee Calendar Combined'[employee name]
// Create Table Filtered by current employee
VAR __table1 = FILTER('Employee Calendar Combined','Employee Calendar Combined'[employee name]=_employee)
// Create a table of all due dates greater than the current day
VAR _table2 = FILTER(__table1,[Due Date Fact Table.Due Date]>=__day)
VAR _total = sumx(_table2,[Due Date Fact Table.Effort])
return
_total

 

 

The Result:This column measure allows me to forecast how busy an employee is based on the scheduled due dates and the amount of effort for each project. I also created a measure that accounts for progression, adjusting the value of the remaining effort.


Employee Workload CalendarEmployee Workload Calendar

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Thanks for coming to my Ted Talk

View solution in original post

9 REPLIES 9
Anonymous
Not applicable

@Anonymous - Could you post your pbix? I think you made this more complicated than it needs to be and I'd be happy to see whether it can be refactored.

Cheers!

Nathan

Anonymous
Not applicable

I sent you a pm regarding this, since there is privledged info in the pbix

Anonymous
Not applicable

Ok so I figured this out after doing some research. Going to post my solution here because I hate going to forums and seeing "nvm figured it out - posted Nov. 2009".

 

I modified the code from this post.

Shoutout to @Greg_Deckler  for figuring this out.

 

My Solution:

  1. Combine the calendar table with a unique employee name table (not pictured in my original question, it's just a list of distinct employee names)
  2. Add on effort to this table, matching the due date and employee combination to the respective row in the combined employee calendar table.
  3. Create a custom column with the following code:

 

Remaining Effort =
// Get the current day and employee for the current row of the calendar table
VAR __day = 'Employee Calendar Combined'[date]
VAR _employee = 'Employee Calendar Combined'[employee name]
// Create Table Filtered by current employee
VAR __table1 = FILTER('Employee Calendar Combined','Employee Calendar Combined'[employee name]=_employee)
// Create a table of all due dates greater than the current day
VAR _table2 = FILTER(__table1,[Due Date Fact Table.Due Date]>=__day)
VAR _total = sumx(_table2,[Due Date Fact Table.Effort])
return
_total

 

 

The Result:This column measure allows me to forecast how busy an employee is based on the scheduled due dates and the amount of effort for each project. I also created a measure that accounts for progression, adjusting the value of the remaining effort.


Employee Workload CalendarEmployee Workload Calendar

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Thanks for coming to my Ted Talk

Ashish_Mathur
Super User
Super User

Hi,

Do you want a calculated column or a measure solution?


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

Hi,

 

I think a calcualted column would work best

Hi,

Share the two tables in a format that can be pasted in an Excel file.


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

@Anonymous  - 

You could do something like this:

Your Measure = 
var date_to_assess = MAX('Date'[Date])
return CALCULATE(SUM(Effort),'Date'[Date] >= date_to_assess)

Hope this helps,

Nathan

Anonymous
Not applicable

Hi Nathan, 

 

I think this is on the right track, but I need to do this at a column level for each unique Employee/Date pair not just the most recent date.

Anonymous
Not applicable

@Anonymous  - I picture the following model:

1. A dimension table for date - it would not include the employee.

2. A dimension table called employee or something like that.

3. The Due Table is a fact table.

4. You can join the 3 tables together, so that the selections in the 2 dimension tables filter the fact table.

 

Then, in a table visual, add the employee column from the employee dimension, the date from the date dimension, and the Measure that I specified. It should give the results you're looking for.

 

Cheers!

Nathan

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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