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.
Hello All
I would like to ask for support because I need to know the sum of the time between each update of the same ticket.
And in the end, for ticket XXXXXX we had a total of hh:mm.
I will provide just 2 samples of tickets, but I have many more.
Many tks for the supporting.
Solved! Go to Solution.
This can be done with a DATEDIFF measure:
Ticket Duration (Days) =
DATEDIFF(
MIN( 'Table'[Comment date (UTC)] ),
MAX( 'Table'[Comment date (UTC)] ),
HOUR
) / 24
Output in a table visual (with Totals off):
Edit:
In case you need duration in d:hh:mm:ss format rather than as a decimal in days:
Ticket Duration (d:hh:mm:ss) =
VAR _secsDifTotal =
DATEDIFF(
MIN( 'Table'[Comment date (UTC)] ),
MAX( 'Table'[Comment date (UTC)] ),
SECOND
)
VAR _secsPerDay = 24 * 60 * 60
VAR _dayPart = INT( _secsDifTotal / _secsPerDay )
VAR _timePart = MOD( _secsDifTotal, _secsPerDay ) / _secsPerDay
RETURN
_dayPart & ":" & FORMAT( _timePart, "hh:mm:ss" )
Hello Greg
How are you?
Let me explain once more, because I don't think I've made it clear.
I need to know the total time between dates for the same ticket.
Thanks for your help.
This can be done with a DATEDIFF measure:
Ticket Duration (Days) =
DATEDIFF(
MIN( 'Table'[Comment date (UTC)] ),
MAX( 'Table'[Comment date (UTC)] ),
HOUR
) / 24
Output in a table visual (with Totals off):
Edit:
In case you need duration in d:hh:mm:ss format rather than as a decimal in days:
Ticket Duration (d:hh:mm:ss) =
VAR _secsDifTotal =
DATEDIFF(
MIN( 'Table'[Comment date (UTC)] ),
MAX( 'Table'[Comment date (UTC)] ),
SECOND
)
VAR _secsPerDay = 24 * 60 * 60
VAR _dayPart = INT( _secsDifTotal / _secsPerDay )
VAR _timePart = MOD( _secsDifTotal, _secsPerDay ) / _secsPerDay
RETURN
_dayPart & ":" & FORMAT( _timePart, "hh:mm:ss" )
Hello
In this case, does it only calculate the difference between the last and first dates, or does it add up the total time between each date to the same ticket?
Tks
It's just getting the difference. If you want to do something like not count the duration for some entries, then it probably makes sense to go the route others suggested re: adding a calculated column to your table that provides the duration using previous ticket row.
Hi @FelippeAzevedo7 please check this
calculated column--
@FelippeAzevedo7 I would suggest this pattern as a calculated column potentially. See my article on Mean Time Between Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395....
The basic pattern is:
Column =
VAR __Current = [Value]
VAR __PreviousDate = MAXX(FILTER('Table','Table'[Date] < EARLIER('Table'[Date])),[Date])
VAR __Previous = MAXX(FILTER('Table',[Date]=__PreviousDate),[Value])
RETURN
( __Current - __Previous ) * 1.
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 |
---|---|
23 | |
10 | |
10 | |
9 | |
7 |