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
Anonymous
Not applicable

Selecting value from 1 column on the basis of other column value

I need to calculate the avg time taken by the docs at each level i.e. how much time it takes for an avg doc to clear the draft stage or In-approval level 1 stage.
I have different docs which have unique levels for each status (according to the process) and timestamp of how much time it took on each status-level.

 

 

image.png

 

 

In text format:-

Doc No.StatusLevelTimestmap
1Draft110/19/2022 , 02:00:43 PM
1In-approval110/20/2022, 04:00:43 PM
1In-approval210/21/2022, 08:00:43 PM
1In-approval310/23/2022, 12:10:43 PM
1In-approval410/23/2022, 12:55:43 PM
1Approved110/24/2022, 01:20:23 PM
1Approved210/25/2022, 02:35:13 PM
1Approved310/26/2022, 04:45:33 PM
1Signature110/27/2022, 08:53:41 AM
1Signature210/27/2022, 08:53:41 PM
1Signature verification110/29/2022, 12:55:43 PM
1Authorized110/30/2022, 12:55:43 PM
2Draft110/19/2022 , 02:22:13 PM
2In-approval110/20/2022, 04:22:23 PM
2In-approval210/21/2022, 12:00:33 PM
2In-approval310/23/2022, 12:42:21 PM
2Approved110/24/2022, 01:20:23 PM
2Approved210/24/2022, 03:20:23 PM
2Approved310/25/2022, 02:35:13 PM
2Approved410/26/2022, 04:45:33 PM
2Signature110/27/2022, 08:53:41 AM
2Signature verification110/29/2022, 12:55:43 PM
2Signature verification210/29/2022, 08:25:26 PM
2Authorized110/30/2022, 05:30:00 PM

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

According to your description, here are my steps you can follow as a solution.

(1) We can create calculated columns.

Rank by No = 
RANKX(FILTER('Data table','Data table'[Doc No.]=EARLIER('Data table'[Doc No.])),'Data table'[Timestmap],,ASC,Dense)
Duration = 
var _lasttimestamp=MAXX(FILTER('Data table','Data table'[Doc No.]=EARLIER('Data table'[Doc No.])&&[Rank by No]=EARLIER('Data table'[Rank by No])+1),'Data table'[Timestmap])
return
DATEDIFF('Data table'[Timestmap],_lasttimestamp,MINUTE)

(2)Then we can create a table.

Expected output = 
SUMMARIZE('Data table','Data table'[Doc No.],'Data table'[Level],"Duration(Hours)",AVERAGE('Data table'[Duration])/60)

(3) Then the result is as follows.

vtangjiemsft_0-1670833393797.png

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution to help the other members find it more quickly. 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Anonymous ,

 

According to your description, here are my steps you can follow as a solution.

(1) We can create calculated columns.

Rank by No = 
RANKX(FILTER('Data table','Data table'[Doc No.]=EARLIER('Data table'[Doc No.])),'Data table'[Timestmap],,ASC,Dense)
Duration = 
var _lasttimestamp=MAXX(FILTER('Data table','Data table'[Doc No.]=EARLIER('Data table'[Doc No.])&&[Rank by No]=EARLIER('Data table'[Rank by No])+1),'Data table'[Timestmap])
return
DATEDIFF('Data table'[Timestmap],_lasttimestamp,MINUTE)

(2)Then we can create a table.

Expected output = 
SUMMARIZE('Data table','Data table'[Doc No.],'Data table'[Level],"Duration(Hours)",AVERAGE('Data table'[Duration])/60)

(3) Then the result is as follows.

vtangjiemsft_0-1670833393797.png

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution to help the other members find it more quickly. 

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.