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
DrTammy
Frequent Visitor

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. 

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @DrTammy 

If you'd like result below:

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

Capture16.JPG

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.

View solution in original post

6 REPLIES 6
v-juanli-msft
Community Support
Community Support

Hi @DrTammy 

If you'd like result below:

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

Capture16.JPG

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.

Fowmy
Super User
Super User


@DrTammy 

Please check this post, it solves somewhat a similar problem:

https://community.powerbi.com/t5/Desktop/Finding-dwell-time/td-p/907482

Meantime, Can you share some sample data and the expected result as data to have a clear understanding of your question?

________________________

Did I answer your question? Mark this post as a solution, this will help others!.

Click on the Thumbs-Up icon on the right if you like this reply 🙂

YouTube, LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

DrTammy
Frequent Visitor

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

@DrTammy 

Can you explain how the expected result should be calculated 

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


Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

DrTammy
Frequent Visitor

@Fowmy I have hundreds of bikes with distinct bike numbers and each bike has made several trips through the city. I have the trips details  including the date and time of start and end points. Probably I need to calculate the dwell time for the bike before it goes on the next trip then take the average of dwell times.

@amitchandakI have already checked that as well but It did not work for my case, it gave me negative hours!

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.