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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Forrestgump1980
New Member

Relate tables results in DAX from 2 different tables that are not related

I have 2 tables that I cannot link because it will create a many to many relationship. 1 Table is called 'Requisitions' the other is called 'New Hires'. Both tables have a field 'Division'. In the 'Requisition' table I can count the number of requistions in a pivot by division, in the 'New Hires' table I can count the number of new hires in a pivot separately. However, I want to combine the results in 1 table. 

 

When I try and bring in the results from the 'New Hires' table to the 'Requisition' table using CountRows("New Hires") it brings back the total 'New Hires' in each row i.e. 5,270 repeated in each division. but what I want is the count to count the number of new hires in each division respectively. 

 

I am currently trying to create something using the functions CALCULATED, VALUES, FILTER but i can't get anything to work at the moment. I am not even sure this is the correct approach. 

 

Any help is greatly appreciated!

1 ACCEPTED SOLUTION

@Forrestgump1980 , This might be context issue, use this measure

 

NewHiresCount =
SUMX(
VALUES('Requisitions'[Division]),
CALCULATE(
COUNTROWS('New Hires'),
FILTER('New Hires', 'New Hires'[Division] = EARLIER('Requisitions'[Division]))
)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

4 REPLIES 4
bhanu_gautam
Super User
Super User

Hi @Forrestgump1980 , you can use DAX measures and the CALCULATE function along with FILTER to get the counts for each division

First measure

RequisitionCount = COUNTROWS('Requisitions')

 

Secondmeasure

NewHiresCount = CALCULATE(
COUNTROWS('New Hires'),
FILTER('New Hires', 'New Hires'[Division] = MAX('Requisitions'[Division]))
)

 

Drag the Division field from the Requisitions table to the Values area of the table visualization.
Drag the RequisitionCount measure to the Values area.
Drag the NewHiresCount measure to the Values area.




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Thanks for this.... I might be something wrong but now the counts are working across the division and are working correctly but unfortunately the total doesn't add up to counts in the NewHiresCount??

@Forrestgump1980 , This might be context issue, use this measure

 

NewHiresCount =
SUMX(
VALUES('Requisitions'[Division]),
CALCULATE(
COUNTROWS('New Hires'),
FILTER('New Hires', 'New Hires'[Division] = EARLIER('Requisitions'[Division]))
)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Thank you so much for your help that worked. I still need to add some filters to the final solution but i will try that on my own first.  Thanks once again!

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.