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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Greenterer
Helper I
Helper I

Using data from one table in a calculation in another table

I have two tables that look like this.  The tables are linked together by Name

Table 1

Name               Task                                  Date Completed      Year/Month

Joe                    Take the order                 April 5, 2023            202304

Joe                    Fill the order                    April 5, 2023            202304

Joe                     Fill the order                   April 6, 2023            202304

 

Table 2

Name                Year/Month                     Days Worked

Joe                    202304                             15

Joe                    202305                             21

 

The goal is to calculate how many tasks each person has completed per days worked each month.  I can  get a total for the tasks completed easily enough.  My problem comes when I try to bring in the days worked.  It seems like it should be simple (and I can do this in Tableau, but I've been forced to convert all of my Tableau workbooks into BI), but I can't find a way to divide the total tasks, which are calculated in Table 1, by the days worked from Table 2.  

           

1 ACCEPTED SOLUTION
tzvetkov_b87
Helper I
Helper I

Hi @Greenterer ,

 

The problem comes from having a many-many relationship and also not know what month you want to work out tasks per month.

 

One way to fix the problem is to create a third table called "Users" which will contain just Joe's name. I am assuming there will be Bob, Alex and many more users.

 

Then Users will have a 1-to-many relationship with Table 1 and Table 2 based on Name.

 

Then you can add the following measure in Users:

Average Tasks per day worked =
VAR days_worked = SUM( 'Table 2'[Days Worked] )
VAR total_tasks = COUNTA( 'Table 1'[Name] )

RETURN
DIVIDE( total_tasks, days_worked )
 
If you just display this on a table with Joe's name and the measure it will give you 0.08.
 
Joe's done 3 tasks in 2 months when he should have worked 36 days. 3/36 = 0.08
 
If you then put the Year/Month field as well in the table it will show you what you want to see.
 
tzvetkov_b87_0-1703092921829.png

 

tzvetkov_b87_1-1703093022804.png

Hope this helps.

 

If this answer helped, please mark it as the correct one and a thumbs up would be great 🙂

 

Boyan

View solution in original post

2 REPLIES 2
Greenterer
Helper I
Helper I

That works perfectly.  Thank you.  

tzvetkov_b87
Helper I
Helper I

Hi @Greenterer ,

 

The problem comes from having a many-many relationship and also not know what month you want to work out tasks per month.

 

One way to fix the problem is to create a third table called "Users" which will contain just Joe's name. I am assuming there will be Bob, Alex and many more users.

 

Then Users will have a 1-to-many relationship with Table 1 and Table 2 based on Name.

 

Then you can add the following measure in Users:

Average Tasks per day worked =
VAR days_worked = SUM( 'Table 2'[Days Worked] )
VAR total_tasks = COUNTA( 'Table 1'[Name] )

RETURN
DIVIDE( total_tasks, days_worked )
 
If you just display this on a table with Joe's name and the measure it will give you 0.08.
 
Joe's done 3 tasks in 2 months when he should have worked 36 days. 3/36 = 0.08
 
If you then put the Year/Month field as well in the table it will show you what you want to see.
 
tzvetkov_b87_0-1703092921829.png

 

tzvetkov_b87_1-1703093022804.png

Hope this helps.

 

If this answer helped, please mark it as the correct one and a thumbs up would be great 🙂

 

Boyan

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors