Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
LarryFisherman
Frequent Visitor

Identifying last activity in a process and outputting value from different column

Hi all,

 

I am working on some processflow data, where I need to check who the last user is for approval within two approval types. Below table showcases how my data looks like, with the last two columns (in bold) being the result I am looking for.

 

DateTimeIDTypeActionUserLast Approval 1 userLast Approval 2 user
01.01.2022 10:001Approval 1ApprovalAADDEE
01.01.2022 12:001Approval 2ApprovalBBDDEE
01.01.2022 12:301EditEditCCDDEE
01.01.2022 14:001Approval 1ApprovalDDDDEE
01.01.2022 15:001Approval 2ApprovalEEDDEE

 

I am looking for solutions in either DAX or Power query.

 

Thanks beforehand.

1 ACCEPTED SOLUTION
LarryFisherman
Frequent Visitor

Hi,

I managed solve this question eventually. Posting it here, if anyone has the same issue:

I create a calculated column that identifies that last entry for Approval 1, I also make a second calculated column where I replace Approval 1 (Marked with bold) with approval 2, to get one column for each approval.

Last Approval 1 user =
VAR MaxDateTime = CALCULATE(MAX(Table1[DateTime]),
FILTER(Table1, Table1[ID] = EARLIER(Table1[ID]) && Table1[Type] = "Approval 1"))
RETURN
CALCULATE(
MAX(Table1[User]),
FILTER(Table1, Table1[ID] = EARLIER(Table1[ID]) && Table1[DateTime] = MaxDateTime)
)
 
This could potentially also have been solved by incorporating RANK, as @christinepayton mentioned, in above DAX, but it wasn't neccesary in this case.

View solution in original post

2 REPLIES 2
LarryFisherman
Frequent Visitor

Hi,

I managed solve this question eventually. Posting it here, if anyone has the same issue:

I create a calculated column that identifies that last entry for Approval 1, I also make a second calculated column where I replace Approval 1 (Marked with bold) with approval 2, to get one column for each approval.

Last Approval 1 user =
VAR MaxDateTime = CALCULATE(MAX(Table1[DateTime]),
FILTER(Table1, Table1[ID] = EARLIER(Table1[ID]) && Table1[Type] = "Approval 1"))
RETURN
CALCULATE(
MAX(Table1[User]),
FILTER(Table1, Table1[ID] = EARLIER(Table1[ID]) && Table1[DateTime] = MaxDateTime)
)
 
This could potentially also have been solved by incorporating RANK, as @christinepayton mentioned, in above DAX, but it wasn't neccesary in this case.
christinepayton
Super User
Super User

I think it should work to use RANK() to order them (assuming on datetime), if you ranked them descending instead of ascending and took the #1 rank that would be the last item. If you're trying to rank over some particular field as the differentiator, use RANKX() instead. 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.