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! Get ahead of the game and start preparing now! Learn more
Hi,
I am new to powerBI. I am trying to create measure to select employee latest designation based on selected time duration. I got confused how to write function for the same. Please help me.
Example is as below:
| Date | Employee Name | Designation | Other data1 |
| 01-04-2021 | Name1 | C | |
| 01-06-2021 | Name2 | C | |
| 01-07-2021 | Name3 | B | |
| 01-04-2022 | Name1 | B | |
| 02-04-2022 | Name5 | C | |
| 03-04-2022 | Name6 | C | |
| 04-04-2022 | Name1 | A | |
| 05-04-2022 | Name8 | B | |
| 06-04-2023 | Name5 | B | |
| 07-04-2023 | Name10 | B | |
| 08-05-2023 | Name6 | B | |
| 09-08-2023 | Name5 | A | |
| 10-08-2023 | Name10 | B | |
| 11-10-2023 | Name5 | A | |
| 12-11-2023 | Name6 | A |
Thank you.
Regards,
Rkumar
@rkumar26 , Try one of the two measures
Last Status = var _max = maxx(filter(ALLSELECTED(Data), Data[Employee Name] = Max(Data[Employee Name])), Data[Date])
return
CALCULATE(max(Data[Designation]), filter((Data) , Data[Date] =_max))
or
Last Status = var _max = maxx(filter(ALLSELECTED(Data), Data[Employee Name] = Max(Data[Employee Name])), Data[Date])
return
CALCULATE(max(Data[Designation]), filter(ALLSELECTED(Data), Data[Employee Name] = Max(Data[Employee Name]) && Data[Date] =_max))
refer
https://amitchandak.medium.com/power-bi-get-the-last-latest-value-of-a-category-d0cf2fcf92d0
Hi Amit,
Thanks for quick response.
Above code is working to show latest desgnation.
Other data 1, lets say hours are summed as per old input of designation, when using slicer for designation.
I was trying to show sum of hours also in same designation when selected.
Thanks you for help.
regards,
Rkumar
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 38 | |
| 36 | |
| 28 | |
| 28 |
| User | Count |
|---|---|
| 124 | |
| 88 | |
| 74 | |
| 66 | |
| 65 |