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 need a quick help with this:
im trying to find the duration between two dates with dax however theres something wrong with the formula as calculating time not correctly and its not considering when the time in the date is AM or PM
first,i used the formula the calculate the diffrenece between the two dates in seconds:
Duration in Seconds= datediff(order pickup date, order cancelation date, second)
after that i wanted to find the duration separated into (days,hours,minutes,seconds) so i used this formula:
duration =
this is an example of how im getting the result:
for the highlted row , its calculating -1 day however result should be 0 hours, 48 minutes and 7 seconds
i can i sum all time to show total with this measure ??? if i want to se a client orders and see times taken for example i want to sum the time with this measure
@lawada
You can use a single measure without having to create a column, please try below as a measure:
Duration Between Cancell and Pickup =
var vSeconds=DATEDIFF(MAX(Orders[order pickup date]),MAX(Orders[order cancelation date]),SECOND)
var vMinutes=int( vSeconds/60)
var vRemainingSeconds=MOD(vSeconds, 60)
var vHours=INT(vMinutes/60)
var vRemainingMinutes=MOD(vMinutes,60)
var vDays=INT(vHours/24)
var vRemainingHours=MOD(vHours,24)
return
IF(
vSeconds > 0 ,
vDays&" Days & "&
vRemainingHours&" Hours & "&
vRemainingMinutes&" Minutes & "&
vRemainingSeconds& " Seconds"
,
BLANK()
)
________________________
If my answer was helpful, please click Accept it as the solution to help other members find it useful
Click on the Thumbs-Up icon if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
20 | |
7 | |
6 | |
5 | |
5 |
User | Count |
---|---|
26 | |
10 | |
10 | |
9 | |
6 |