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 have data by transport transactions. A parcel can travel mutiple legs before it reach the end location. I want to make a dwell time analysis of the nodes in the network the parcels passes. For each location (A, B, C, etc) how long time are the parcel staying there in average?
| Article | Leg start location | Start time | Leg End location | Arrival time |
| 1 | A | 2020-01-01 | B | 2020-01-03 |
| 1 | B | 2020-01-05 | C | 2020-01-06 |
| 2 | A | 2020-01-01 | B | 2020-01-03 |
| 2 | B | 2020-01-04 | C | 2020-01-05 |
| 3 | A | 2020-01-01 | B | 2020-01-03 |
| 3 | B | 2020-01-04 | D | 2020-01-04 |
| 3 | D | 2020-01-05 | C | 2020-01-06 |
Any good idea?
Solved! Go to Solution.
Hi @Anonymous ,
First, I added index columns to the query editor to get the last arrival time.
Create measure to get the last arrival time and calculate the time difference.
Measure 2 =
VAR current_index =
SELECTEDVALUE ( 'Table'[Index] )
VAR last_a_date =
CALCULATE (
FIRSTNONBLANK ( 'Table'[ Arrival time], 1 ),
FILTER (
ALLEXCEPT ( 'Table', 'Table'[Article] ),
'Table'[Index] = current_index - 1
)
)
RETURN
DATEDIFF ( last_a_date, MAX ( 'Table'[ Start time] ), DAY )Calculate the average time of each location.
Measure 3 = AVERAGEX(ALLEXCEPT('Table','Table'[ Leg End location]),[Measure 2])
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
First, I added index columns to the query editor to get the last arrival time.
Create measure to get the last arrival time and calculate the time difference.
Measure 2 =
VAR current_index =
SELECTEDVALUE ( 'Table'[Index] )
VAR last_a_date =
CALCULATE (
FIRSTNONBLANK ( 'Table'[ Arrival time], 1 ),
FILTER (
ALLEXCEPT ( 'Table', 'Table'[Article] ),
'Table'[Index] = current_index - 1
)
)
RETURN
DATEDIFF ( last_a_date, MAX ( 'Table'[ Start time] ), DAY )Calculate the average time of each location.
Measure 3 = AVERAGEX(ALLEXCEPT('Table','Table'[ Leg End location]),[Measure 2])
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 41 | |
| 38 | |
| 36 | |
| 31 | |
| 28 |
| User | Count |
|---|---|
| 128 | |
| 88 | |
| 79 | |
| 68 | |
| 63 |