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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
bboobe
Helper I
Helper I

NEED HELP Compare columns in two tables and Find Difference

Hi Experts 

I am trying to compare a master file with daily employee file 

In Master table, I have unique department code for each Project code  

In Employee table, I have more than one department code for a single project as the department is tagged incorrectly by the employee level.

I am stuck with this now. Please advise.

 

Below is the Sample - 

Employee Table Project ID - 12345 

Employee Table Department ID - 100

Master table Departement id - 101 

Result - False

1 ACCEPTED SOLUTION
nandukrishnavs
Community Champion
Community Champion

@bboobe 

 

Master Table

Project IDDepartment ID
1200101
1201120

 

EmployeeTable

Project IDEmployee IDDepartment ID
12001100
12012120

 

Status Check = 
var _selectedDepartment= CALCULATE(SELECTEDVALUE(EmployeeTable[Department ID]))
var _selectedProjectId= CALCULATE(SELECTEDVALUE(EmployeeTable[Project ID]))
var _actualDepartment= CALCULATE(LOOKUPVALUE(MasterTable[Department ID],MasterTable[Project ID],_selectedProjectId))
var _result= IF(_actualDepartment=_selectedDepartment,TRUE(),FALSE())
return _result

 

Capture.JPG 

If this is not working, please share your sample tables with 5 rows and expected output.



Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂


Regards,
Nandu Krishna

View solution in original post

4 REPLIES 4
nandukrishnavs
Community Champion
Community Champion

@bboobe 

 

Master Table

Project IDDepartment ID
1200101
1201120

 

EmployeeTable

Project IDEmployee IDDepartment ID
12001100
12012120

 

Status Check = 
var _selectedDepartment= CALCULATE(SELECTEDVALUE(EmployeeTable[Department ID]))
var _selectedProjectId= CALCULATE(SELECTEDVALUE(EmployeeTable[Project ID]))
var _actualDepartment= CALCULATE(LOOKUPVALUE(MasterTable[Department ID],MasterTable[Project ID],_selectedProjectId))
var _result= IF(_actualDepartment=_selectedDepartment,TRUE(),FALSE())
return _result

 

Capture.JPG 

If this is not working, please share your sample tables with 5 rows and expected output.



Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂


Regards,
Nandu Krishna

Thank you @nandukrishnavs  It worked. 🙂 

az38
Community Champion
Community Champion

@bboobe 

there is not full data model but it may looked like

Measure = 
var _curDepartment = MAX('Master'[Departement id])

RETURN
IF(
CALCULATE(COUNTROWS('Employee'), FILTER(ALL('Employee'), 'Employee'[Departement id]=_curDepartment) ) > 0, 
TRUE(), 
FALSE()
)

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Thank you for taking time and responding @az38 . I tried the above measure and it did not work. Below is the screenshot from the visual.

 

 

The comparison has to be done on employee level. and i need to view only the employee ids with incorrect department.  

Capture.JPG

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

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

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