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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
aishak12
Helper IV
Helper IV

Comparing 2 excel sheets

I am importing 2 excel sheets. I have one that lists all active employee's, the other one lists employee's with borrowed items. 

 

Is there a DAX function I can use to run (Active employee's against employee's with borrowed items) 

 

The result will be terminated employee's as anyone without a borrowed item is no longer working for this company.

 

 

6 REPLIES 6
MauriceMecowe
Resolver II
Resolver II

Hi @aishak12 ,

 

Have a look at this post, I think this is what you're looking for.

 

https://community.powerbi.com/t5/Desktop/Compare-2-columns-from-2-different-sheets/td-p/318659 

 

Cheers,

Maurice

Greg_Deckler
Community Champion
Community Champion

@aishak12 Yes, you can use EXCEPT for this purpose, so something like:

Table =
  VAR __ActiveEmployees = SELECTCOLUMNS('Sheet1',"Employee",[Employee])
  VAR __BorrowingEmployees = SELECTCOLUMNS('Sheet2',"Employee",[Employee])
RETURN
  EXCEPT(__ActiveEmployees,__BorrowingEmployees)


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
edhans
Super User
Super User

You could use the LOOKUPVALUE() function, which will allow you to look up values in one table against another. Then you could use the ISBLANK() function to see if you returned anything. I'd need data though to show you an example.

 

Ideally you could do this in Power Query with a merge. That is where I would try to do this as modeling there typically works better than in the DAX side, which is best for analysis.

 

But in any case, I'd need some data @aishak12 

 

How to get good help fast. Help us help you.
How to Get Your Question Answered Quickly
How to provide sample data in the Power BI Forum



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Query 1 (Excel sheet 1) = EmployeesList 

Column name = Username

aishak12_0-1601336326393.png

 

Query 2 (Excel Sheet 2) = redbeam

Column name = Username

 

aishak12_1-1601336395066.png

 

Could you help me write a function that compares username for both sheets.

 

hi  @aishak12 

Above solution should all work for your case,

Table =
  VAR __ActiveEmployees = SELECTCOLUMNS('EmployeesList','EmployeesList'[Employee])
  VAR __BorrowingEmployees = SELECTCOLUMNS('redbeam','redbeam',[Employee])
RETURN
  EXCEPT(__ActiveEmployees,__BorrowingEmployees)

https://docs.microsoft.com/en-us/dax/except-function-dax

 

IF not your case, What is your expected output?

Please see this post regarding How to Get Your Question Answered Quickly:
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

Regards,

Lin

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

What do you mean "compares" @aishak12 ?

  • That the same thing in row 1 of the first sheet is the first thing of the second sheet, and so on?
  • That the names in sheet 1 exist in sheet 2? (true/false indicator)
  • that the names in sheet 2 exist in sheet 1? (true/false indicator)
  • Do the comparisons need to be case sensistive?
  • Do you want the result to be only names that are:
    • in both columns,
    • or only in sheet 1 and not sheet 2,
    • or only sheet 2 and not sheet 1,
    • or all names not in both sheets?

Be very clear what you are trying to accomplish. "compare" is very generic.

 

 

Can you provide actual data too, not screen shots. Don't make us key stuff in. 😁

How to get good help fast. Help us help you.
How to Get Your Question Answered Quickly
How to provide sample data in the Power BI Forum



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

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!

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.