Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!
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
| User | Count |
|---|---|
| 53 | |
| 40 | |
| 35 | |
| 24 | |
| 22 |
| User | Count |
|---|---|
| 136 | |
| 111 | |
| 58 | |
| 43 | |
| 38 |