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 All
I have this table, which tracks changes to employee status,
and I sorted values of column named [EmployeeID] in ascending order. I am looking for M query that checks if value in column [EmployeeID] is same in next row (meaning that change relates to same employee), then create a column named [EndDate] to show when that [StatusAfter] ended and a column named [CurrentStatus] to show if that status is current.
After this I would merge queries with same table to end up with my desired table, which would be like below;
How can i do that?
Solved! Go to Solution.
Hi,
I have changed 2 dates to try (i don't know if it is true).
refer to fantastic video of Goodly for knowledge
https://www.youtube.com/watch?v=IGF2-qfzDQs
If this post is useful to help you to solve your issue, consider giving the post a thumbs up and accepting it as a solution!
Hi,
I have changed 2 dates to try (i don't know if it is true).
refer to fantastic video of Goodly for knowledge
https://www.youtube.com/watch?v=IGF2-qfzDQs
If this post is useful to help you to solve your issue, consider giving the post a thumbs up and accepting it as a solution!
Hi,
probably you have some problem in your example.
What about ID26 where the current is not the last one?
You can use the following M code to achieve the desired output:
This formula checks if the current [EmployeeID] value is the same as the [EmployeeID] value in the next row. If it is, it subtracts one day from the [EffectiveDate] to get the [EndDate], otherwise it returns null.
This formula checks if the [EndDate] is null, meaning the current row is the latest status for that employee, and returns "Yes" for [CurrentStatus]. Otherwise, it checks if the [EffectiveDate] is equal to the maximum [EffectiveDate] value for that employee, and returns "Yes" for [CurrentStatus] if it is, otherwise it returns "No".
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.