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

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.

Reply
Anonymous
Not applicable

Dwell time analysis of network

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 A2020-01-01 B2020-01-03
 B2020-01-05 C2020-01-06
2 A2020-01-01 B2020-01-03
2 B2020-01-04 C2020-01-05
3 A2020-01-01 B2020-01-03
3 B2020-01-04 D2020-01-04
3 D2020-01-05 C2020-01-06

 

 

Any good idea?

1 ACCEPTED SOLUTION
V-lianl-msft
Community Support
Community Support

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])

test_Dwell time analysis of network.PNG

Sample .pbix

 

Best Regards,
Liang
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
V-lianl-msft
Community Support
Community Support

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])

test_Dwell time analysis of network.PNG

Sample .pbix

 

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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