Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more
Hi All,
I am facing an issue in Power BI Desktop. I have created a measure for calculating last status based on timestamp for each employee. Now I want to draw a bar chart to display count of emplyee for each status.
Here is sample data
EmployeeId | StatusID | Datestamp |
1 | 1 | 2017-05-01 11:30:00 |
1 | 3 | 2017-05-01 11:35:00 |
1 | 2 | 2017-05-01 11:40:00 |
2 | 3 | 2017-05-01 11:30:00 |
2 | 2 | 2017-05-01 11:35:00 |
2 | 1 | 2017-05-01 11:40:00 |
3 | 3 | 2017-05-01 11:42:00 |
4 | 1 | 2017-05-01 11:42:00 |
Status Table
StatusID | Status Name |
1 | Started |
2 | In progress |
3 | Completed |
I am expecting result in graph as following (count of employee is based on latest status
Status Name | Count of Employees |
Started | 2 |
In progress | 1 |
Completed | 1 |
Thanks in Advance.
Hi,
Could you please tell me if your problem is solved? You can mark the right answer to help others if it's convenient for you.
Best Regards!
Dale
Hi,
At the first glance, it's very easy. But there are many tricks. A calculated column is recommended. Here is the formula. Please have a try.
IsLatest = CALCULATE ( IF ( COUNT ( 'Sample'[Datestamp] ) = 1, 1, 0 ), FILTER ( 'Sample', 'Sample'[Datestamp] >= EARLIER ( 'Sample'[Datestamp] ) && 'Sample'[EmployeeId] = EARLIER ( 'Sample'[EmployeeId] ) ) )
Best Regards.
Dale