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
PiotrCalka
Regular Visitor

Help with DAX to deduct data from two tables based on ID& Date

Hello,

I have two tables:

- Annual Plans with columns: project_id, employee_id, Date 

- Leaves with columns: employee_id, Date 

There is no direct relatinoship between tables. Both have realtion to Calendar table and ID employee table.

I am counting DISTINCTCOUNT(Annual_Plans[employee_id]) - to see number of employees,

I need to see number of employees dedecuted by those who are on break (Leaves), so Annual Plans - Leaves per project id.
It needs to be sth like: If dates and employee_id from two tables equals then deduct Annuals Plans - Leave.
I would be gratefull for tips how to do it in DAX.

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @PiotrCalka 

please try

=
COUNTROWS (
EXCEPT ( VALUES ( Annual_Plans[employee_id] ), VALUES ( Leaves[employee_id] ) )
)

View solution in original post

4 REPLIES 4
PiotrCalka
Regular Visitor

Thank you all,

Thank you @tamerj1 this work as I wanted.

Anonymous
Not applicable

Hi @PiotrCalka ,

Could you please provide more details? Your pbix file without privacy inforamtion and desired output with screenshots.

 

How to Get Your Question Answered Quickly 

 

Best Regards
Community Support Team _ Polly

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

 

tamerj1
Super User
Super User

Hi @PiotrCalka 

please try

=
COUNTROWS (
EXCEPT ( VALUES ( Annual_Plans[employee_id] ), VALUES ( Leaves[employee_id] ) )
)

lbendlin
Super User
Super User

Please provide sanitized sample data that fully covers your issue.
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

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.