Forum Discussion
Help on DAX function for Data filter
We have a set of certification information along with the user details as mentioned in Table 1. Based on certain certification rules (mentioned in the Certification Rule Section), we need to report the certification status of all the users with respect to year as shown in Table 3.
Can someone please help me out with the DAX formulation for this? Thank you in advance
Table 1
User Email | User Role | Joining Date | Date of leaving | Certification Name | Certification Attempt Date | Results | User Status |
Role 1 | 20-Dec-20 |
| Quiz1 | 13-Feb-21 | Pass | Active | |
Role 1 | 20-Dec-20 |
| Quiz2 | 04-Mar-21 | Pass | Active | |
Role 1 | 20-Dec-20 |
| Quiz2 | 05-Mar-21 | Fail | Active | |
Role 1 | 20-Dec-20 |
| Quiz3 | 03-Feb-21 | Pass | Active | |
Role 1 | 20-Dec-20 |
| Quiz4 | 03-Feb-21 | Pass | Active | |
Role 1 | 20-Dec-20 |
| Quiz4 | 19-Apr-22 | Pass | Active | |
Role 1 | 20-Dec-20 |
| Quiz3 | 02-May-22 | Pass | Active | |
Role 1 | 20-Dec-20 |
| Quiz3 | 21-Feb-23 | Fail | Active | |
Role 1 | 20-Dec-20 |
| Quiz4 | 03-Feb-23 | Pass | Active | |
Role 2 | 10-Oct-21 |
| Quiz5 | 02-Jan-22 | Pass | Active | |
Role 1 | 11-Jan-15 | 03-Jul-21 | Quiz2 | 03-Mar-21 | Pass | Inactive | |
Role 2 | 20-Mar-20 | 07-Oct-21 | Quiz6 | 25-Jan-21 | Pass | Inactive | |
Role 1 | 10-Feb-22 |
| Quiz2 | 04-Oct-22 | Pass | Active |
Input Description:
- Column A: email ID of the employee
- Column B: Employee role
- Column C: Employee joining date
- Column 😧 Employee leaving date (if applicable)
- Column E: Name of the quiz
- Column F: Certification attempt date
- Column E: Certification result
- Column H: Status of the employee
Certification Rule:
- Role 1 must complete every year all of the Quiz 1, Quiz 2, Quiz 3, and Quiz 4 to ensure their certification is completed.
- Role 2 must complete every year any one of the Quiz 5 or Quiz 6 to ensure their quiz status is completed.
- Current certification status is computed, however, for the past quarter certification status is computed on the last day of the quarter
- If the all required certification is done in one year, then the status = completed, If the certification is partially done, then the status is = incomplete, certification is not passed at all the status = not started, and if the employee is left before the last day of the quarter, then status = not applicable
Eg: Lets say 1 employee (email id [email protected]) with Role 1, joined on 20-Dec-2020, completed Quiz 1, Quiz 2, Quiz 3 on 20 Feb 2021, and Quiz 4 on Q4 2021. After that he completes Quiz 1 & Quiz 2 in Q2 2022, and no quiz completed after that. And he is still an active employee. So the output should be as follows:
Table 2
User Email | Year | Certification Status Q1 | Certification Status Q2 | Certification Status Q3 | Certification Status Q4 |
2020 | Not applicable | Not applicable | Not applicable | Not started | |
User email | Year | Certification Status Q1 | Certification Status Q2 | Certification Status Q3 | Certification Status Q4 |
2021 | Incomplete | Incomplete | Incomplete | Completed | |
2022 | Incomplete | Incomplete | Incomplete | Incomplete | |
2023 | Not started | Not started | Not started | Not started |
- If an employee leaves at the mid of the year, output table will have his email id till end of that year, next year his name will not appear.
- Certification status reset to not started at the beginning of every year (1st January)
Therefore, the output should have the following matrix in the power query.
Table 3
User Email | Year | Certification Status Q1 | Certification Status Q2 | Certification Status Q3 | Certification Status Q4 |
2020 | Not applicable | Not applicable | Not applicable | Not started | |
2021 | Completed | Completed | Completed | Completed | |
2022 | Not started | Incomplete | Incomplete | Incomplete | |
2023 | Incomplete | Incomplete | Incomplete | Incomplete | |
2020 | Not applicable | Not applicable | Not applicable | Not applicable | |
2021 | Not applicable | Not applicable | Not applicable | Not started | |
2022 | Completed | Completed | Completed | Completed | |
2023 | Not started | Not started | Not started | Not started | |
2020 | Not started | Not started | Not started | Not started | |
2021 | Incomplete | Incomplete | Not applicable | Not applicable | |
2020 | Not started | Not started | Not started | Not started | |
2021 | Completed | Completed | Completed | Not applicable | |
2022 | Not started | Not started | Not started | Incomplete | |
2023 | Not started | Not started | Not started | Not started |
1 Reply
- lbendlinSuper User
Your rules seem to apply to years. Your expected outcome shows quarters. Please explain how this is derived.