Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I'm really new to Power BI and was asked to create a report that shows the average drop off time at our warehouse. What is the best way to calculate the time difference based off of a variable in another column?
Essentially I need to take every UDC listed and see the time taken between the Pickup and Dropoff.
Solved! Go to Solution.
Hi @Anonymous
you can try create a measure
Avg Time =
AVERAGEX (
VALUES ( TableName[UDC] ),
CALCULATE (
DATEDIFF ( MIN ( TableName[TIME] ), MAX ( TableName[TIME] ), SECOND )
)
)
I actually had to create a new table. Once I moved the function over there it started to work.
Avg Drop Off Time In Seconds =
AVERAGEX (
VALUES ( 'IN THE LAST'[UDC] ),
CALCULATE (
DATEDIFF ( MIN ( 'IN THE LAST'[Time Format] ), MAX ( 'IN THE LAST'[Time Format] ), SECOND )
)
)
Thanks for pointing me in the right direction.
Thanks for the reply @tamerj1
I input the code into Power BI and it gives me a Avg time of zero. I do have a filter set up so that it can limit the results down to the last 7, 14, and 30 days.
This is the code that I have put in.
Hi @Anonymous
you can try create a measure
Avg Time =
AVERAGEX (
VALUES ( TableName[UDC] ),
CALCULATE (
DATEDIFF ( MIN ( TableName[TIME] ), MAX ( TableName[TIME] ), SECOND )
)
)
User | Count |
---|---|
25 | |
12 | |
8 | |
6 | |
6 |
User | Count |
---|---|
26 | |
12 | |
11 | |
8 | |
7 |