Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |