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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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.

v-rongtiep-msft
Community Support
Community Support

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors