Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers!
Enter the sweepstakes now!See when key Fabric features will launch and what’s already live, all in one place and always up to date. Explore the new Fabric roadmap
Hello,
I have a set of data with employee, ID and training details. I need to tag those employees who have completed the set of training under one Sales Strategy based on number of training's they did also taking into account the year they completed the training.
ID | Name | Training | Effective Date | Expected results |
2580 | Emplyee X | Sales Strategy – Execution | 30-06-2020 00:00 | 4 |
2580 | Emplyee X | Sales strategy – Practical | 30-06-2020 00:00 | 4 |
2580 | Emplyee X | Sales strategy – Explain | 30-06-2020 00:00 | 4 |
2580 | Emplyee X | Sales strategy – Welcome | 30-06-2020 00:00 | 4 |
2580 | Emplyee X | Sales strategy – Discern | 31-05-2020 00:00 | 1 |
1388 | Emplyee Z | Sales strategy – Practical | 31-05-2019 00:00 | 1 |
1388 | Emplyee Z | Sales strategy – Explain | 30-04-2020 00:00 | 2 |
1388 | Emplyee Z | Sales strategy – Welcome | 30-03-2020 00:00 | 2 |
So, to complete the Sales strategy course, the employee must complete 5 trainings:
Sales Strategy – Execution,Sales strategy – Practical,Sales strategy – Explain,Sales strategy – Welcome,Sales strategy – Discern.
Also, the year of completion matters. for example, X completed first 4 trainings in 2020 so the expected result in the column should be 4. In 2019,X completed 1 training under sales strategy category so expected result in the column should be 1.
Please help with the DAX as I am new to Power BI.
Solved! Go to Solution.
There are many ways of doing that, here's one example.
result =
var e=SELECTEDVALUE(Table3[ID])
var y=year(SELECTEDVALUE(Table3[Effective Date]))
return CALCULATE(DISTINCTCOUNT(Table3[Training]),ALLSELECTED(Table3),Table3[ID]=e,YEAR(Table3[Effective Date])=y)
Note that your sample data does not match your expected results - Emplyee X has completed 5 courses in 2020.
There are many ways of doing that, here's one example.
result =
var e=SELECTEDVALUE(Table3[ID])
var y=year(SELECTEDVALUE(Table3[Effective Date]))
return CALCULATE(DISTINCTCOUNT(Table3[Training]),ALLSELECTED(Table3),Table3[ID]=e,YEAR(Table3[Effective Date])=y)
Note that your sample data does not match your expected results - Emplyee X has completed 5 courses in 2020.
Thank you! This worked.
User | Count |
---|---|
19 | |
18 | |
16 | |
13 | |
13 |
User | Count |
---|---|
9 | |
8 | |
8 | |
7 | |
6 |