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.
Hi everyone,
I have a data model where I Have an Employee table that has every employee in it. That table has employee name, hire date, terminated date and a iscurrent field telling if they are currently employed now or not. Term date is null if they are still employed.
I then have that table linked to a wages file by employee ID that contains their historical earnings.
I have the following DAX Code that allows me to calculate the last 12 months of pay for current employees. However, it doesn't work for people that left in the past since this goes from today until 12 months ago. Is there a way I can modify this DAX to use the terminated date field in the employee table to get the last 12 months of pay from the day they left?
var varToday = Today() var varYearAgo = varToday - 365 RETURN CALCULATE( SUM(Earnings[EarningsAmount]), FILTER('Earnings', 'Earnings'[Date] <= varToday && 'Earnings'[Date]>= varYearAgo ))
Solved! Go to Solution.
Can you build the filter on the Terminate date and if it is blank then use Today as the date
Hi,
Share some data and show thr expected result.
Can you build the filter on the Terminate date and if it is blank then use Today as the date
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
97 | |
84 | |
67 | |
59 |
User | Count |
---|---|
150 | |
120 | |
99 | |
87 | |
68 |