Need to calculate time Elapsed in Power Query (B2-B1) then (B3-B2)..........

srehman

Board Regular
Joined
Jan 4, 2020
Messages
210
Office Version
  1. 2016
Platform
  1. Windows
Time Elapsed.xlsx
ABC
1Count 1Count TimeTime Elapsed
215:20:38#VALUE!
325:20:430:00:05
435:20:450:00:02
545:20:470:00:02
655:20:490:00:02
765:20:510:00:02
875:21:190:00:28
985:21:240:00:05
1095:21:260:00:02
11105:21:280:00:02
STOCK_CHECK_DETAILS_by_date_ran
Cell Formulas
RangeFormula
C2:C11C2=B2-B1
Named Ranges
NameRefers ToCells
_FilterDatabase=STOCK_CHECK_DETAILS_by_date_ran!$B$1:$C$1C2
 

Attachments

  • Time Elapsed.PNG
    Time Elapsed.PNG
    7.2 KB · Views: 8

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Yes i used as well in Excel, i want to use this Logic in power query how can i define b2-b1, b3-b2 ,
 
Upvote 0
try adapt code from MarcelBeug

 
Upvote 0
Add two index columns to your table. The first starting with 1, the second with zero. Merge the table with itself and join the first index with the second index. Then use this Mcode on the merged table

Rich (BB code):
let
    Source = Table.NestedJoin(Table1, {"Index"}, Table1, {"Index.1"}, "Table1", JoinKind.LeftOuter),
    #"Expanded Table1" = Table.ExpandTableColumn(Source, "Table1", {"Count Time"}, {"Table1.Count Time"}),
    #"Added Custom" = Table.AddColumn(#"Expanded Table1", "Difference", each [Table1.Count Time]-[Count Time]),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Index", "Index.1", "Table1.Count Time"}),
    #"Added Custom1" = Table.AddColumn(#"Removed Columns", "Custom", each Duration.Seconds([Difference])),
    #"Renamed Columns" = Table.RenameColumns(#"Added Custom1",{{"Custom", "Seconds diff"}}),
    #"Removed Columns1" = Table.RemoveColumns(#"Renamed Columns",{"Difference"})
in
    #"Removed Columns1"

Book9
ABC
1Count 1Count TimeSeconds diff
215:20:38 AM5
325:20:43 AM2
435:20:45 AM2
545:20:47 AM2
655:20:49 AM2
765:20:51 AM28
875:21:19 AM5
985:21:24 AM2
1095:21:26 AM2
11105:21:28 AM
Sheet2
 

Attachments

  • Capture.JPG
    Capture.JPG
    45.3 KB · Views: 9
Upvote 0

Forum statistics

Threads
1,223,792
Messages
6,174,612
Members
452,574
Latest member
hang_and_bang

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top