Forum Discussion

DrTammy's avatar
DrTammy
Frequent Visitor
6 years ago
Solved

Dwell time analysis

I am new to Power Bi and I really appreciatte if you could help me with my problem. I need to analyse the dwell time for a number of bikes in shared bike program. 

  • Hi DrTammy 

    If you'd like result below:

    average hours spent in cities before the selected date period for every bike id.

    Measure below:

    average time =
    CALCULATE (
        SUM ( Sheet4[hours] ),
        FILTER (
            ALLEXCEPT ( Sheet4, Sheet4[bike id] ),
            Sheet4[end datetime].[Date] <= MIN ( 'date'[Date] )
        )
    )
        / CALCULATE (
            COUNT ( Sheet4[bike id] ),
            FILTER (
                ALLEXCEPT ( Sheet4, Sheet4[bike id] ),
                Sheet4[end datetime].[Date] <= MIN ( 'date'[Date] )
            )
        )
    

    "Date" is a table without relationship between "date" and "Sheet3",

    "hours" is a column created in transform data

    Duration.TotalHours([end datetime]-[start datetime])

    Best Regards
    Maggie
    Community Support Team _ Maggie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

6 Replies

  • v-juanli-msft's avatar
    v-juanli-msft
    Community Support

    Hi DrTammy 

    If you'd like result below:

    average hours spent in cities before the selected date period for every bike id.

    Measure below:

    average time =
    CALCULATE (
        SUM ( Sheet4[hours] ),
        FILTER (
            ALLEXCEPT ( Sheet4, Sheet4[bike id] ),
            Sheet4[end datetime].[Date] <= MIN ( 'date'[Date] )
        )
    )
        / CALCULATE (
            COUNT ( Sheet4[bike id] ),
            FILTER (
                ALLEXCEPT ( Sheet4, Sheet4[bike id] ),
                Sheet4[end datetime].[Date] <= MIN ( 'date'[Date] )
            )
        )
    

    "Date" is a table without relationship between "date" and "Sheet3",

    "hours" is a column created in transform data

    Duration.TotalHours([end datetime]-[start datetime])

    Best Regards
    Maggie
    Community Support Team _ Maggie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • DrTammy's avatar
      DrTammy
      Frequent Visitor

      Thanks for your reply but I have aleady checked that post but it did not help me! 

      • Fowmy's avatar
        Fowmy
        Super User

        DrTammy 

        Can you explain how the expected result should be calculated 

        You have got start Date/Time and End Date/Time and Duration.