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.
Hello,
I would like to add a filter in the Power BI report to select whether the employee is Active, Pending, or Exited.
Below is my data.
Employee name | Employment start date | Employment end date |
John | 01/01/2021 | Never |
Adam | 01/01/2010 | 01/01/2021 |
Celina | 12/12/2021 | Never |
Jennifer | 05/07/2021 | Never |
How can I achieve this in Power BI?
For the active employees: The employment start and end dates are between the current date.
employment start date<= current date && employment end date >= current date
For the Exited employees: This should be past employees. The employment end date should be less than the current date
For the Pending employees: These should be future employees which means the employment start date is greater than the current date.
Solved! Go to Solution.
@Anonymous you need a calculated column for slicer as following
Column = switch ( TRUE(), Emp[Employment end date]="Never", "Active", Emp[Employment start date]>=TODAY(),"Pending", CONVERT(Emp[Employment end date],DATETIME)<TODAY(),"Exited")
@Anonymous you need a calculated column for slicer as following
Column = switch ( TRUE(), Emp[Employment end date]="Never", "Active", Emp[Employment start date]>=TODAY(),"Pending", CONVERT(Emp[Employment end date],DATETIME)<TODAY(),"Exited")
You need to swap the order of the first and second clause in the SWITCH Statement.
Proud to be a Super User!
Paul on Linkedin.
Thanks @PaulDBrown ; please give the above a try @Anonymous
@Anonymous "I would like to add a filter in the Power BI report to select whether the employee is Active, Pending, or Exited." - based on what logic?
I edited the post and added logic.
Thanks the solution works.
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 | |
100 | |
76 | |
74 | |
49 |
User | Count |
---|---|
146 | |
108 | |
106 | |
90 | |
62 |