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

Create a measure from two tables that are not connected or linked to each other

Hi,

I have two tables one is for Hiring Table and one is for Termination Table, both have Employee ID and what I need is to do the below:

 

Termination Table:

- Employee ID

- Term Date

- Term Category (voluntary , involuntary, Nutrue)

 

Hiring Table:

- Employee ID

- Hiring Date

 

What I need to do is to create a measure that can calculate how many employees were terminated before 6 months. The challenge is I cannot measure this using only Termination table as I don't have the Hiring Date, but I have it in the Hiring Table, is there any solution for this?

 

Thank you!

1 ACCEPTED SOLUTION
v-angzheng-msft
Community Support
Community Support

Hi, @Anonymous 

Try this:

Hiring Date = 
MAXX(FILTER(ALL('Hiring Table'),'Hiring Table'[Employee ID]=MAX('Termination Table'[Employee ID])),[Hiring Date])
Datediff = 
DATEDIFF([Hiring Date],SELECTEDVALUE('Termination Table'[Term Date]),MONTH)
is6 = 
SUMX(ADDCOLUMNS('Termination Table',"_is6",IF([Datediff]<=6,1,0)),[_is6])


Result:

vangzhengmsft_0-1647243426059.png

Please refer to the attachment below for details.

Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng


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

4 REPLIES 4
v-angzheng-msft
Community Support
Community Support

Hi, @Anonymous 

Try this:

Hiring Date = 
MAXX(FILTER(ALL('Hiring Table'),'Hiring Table'[Employee ID]=MAX('Termination Table'[Employee ID])),[Hiring Date])
Datediff = 
DATEDIFF([Hiring Date],SELECTEDVALUE('Termination Table'[Term Date]),MONTH)
is6 = 
SUMX(ADDCOLUMNS('Termination Table',"_is6",IF([Datediff]<=6,1,0)),[_is6])


Result:

vangzhengmsft_0-1647243426059.png

Please refer to the attachment below for details.

Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng


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

johnt75
Super User
Super User

Num terminated 6 months =
var summaryTable = ADDCOLUMNS( SUMMARIZE( 'Terminated', 'Terminated'[Employee ID], 'Terminated[Term Date]),
"@months worked",
var hireDate = LOOKUPVALUE( 'Hired'[Hire date], 'Hired'[Employee ID], SELECTEDVALUE( 'Terminated'[Employee ID] ) )
return DATEDIFF( hireDate, SELECTEDVALUE( 'Terminated'[Term Date] ), MONTH )
)
return COUNTROWS( FILTER( summaryTable, [@months worked] < 6 ) )
Anonymous
Not applicable

Hi, thank you for your help. I tried your measure and the results came out inclduing all the total terminations (including more than 6 months hires), any suggestion to fix that?

I don't immediately see the problem. Can you share some sample data or a pbix file ?

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