Forum Discussion
DAX function to check if record exists in multiple files
Hi everyone! Could you please advise me on below scenario
I get 2 source files (Excel) named HeadCount and Terminations every week and I combine latest 6 of each of these files and load them to PowerBI. Both the files have a load date column which differentiates the data from week to week.
I use load date column from HeadCount file to count the number of employees each week and termination date column from Terminations file to count nuumber of terminations in a week.
Now I have a requirement to calculate the count of employees that exists in prior week AND doesn't exists in current week AND doesn't exist in Terminations file.
Here is the link to my sample datasets:
https://1drv.ms/f/s!AtqcKHVDSd3QghmFZSDgcfcVhoOJ
My snapshot of data below
Consider 2/2/2019 is current week and 1/26/2019 is prior week. My condition is emp id (EXISTS IN PRIOR WEEK AND DOESNT EXIST IN CURRENT WEEK) to be checked from HeadCount file AND (DOESNT EXIST IN TERMINATIONS) to be checked from Terminations file. Now, If you look at my HeadCount data, Emp ID s 4,5,6 exists in prior week(1/26) and doesnt exists in current week (2/2). Then comparing it with Terminations file for current week (2/2), Emp IDs 5 and 6 doesnt exist in Terminations.
So my result should be 2 which is count of employee ids that satisfies the above three conditions.
Any ideas how this can be implemented in DAX? Or any other ideas how this can be achieved?
Hoping for a solution here in this forum
Greatly appreciate your response and efforts!
8 Replies
- Ashish_Mathur
Super User
Hi,
Share sample datasets and show the expected result.
- AnonymousNot applicable
Ashish_Mathur Hi, I edited my original post to include link for sample datasets and snapshots of my data for a quick view.
Thank you!
- Ashish_Mathur
Super User