Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello.
I have a ticket table, which lists all the tickets we have, with columns such as closed date, opened date, state
I need to be able to calcuate the duration of each ticket as a colum in my table.
At the moment, i have closed at - opened at which gives me the duration... But this does not account for tickets that are not closed.
I need to have one column which does the following : If the ticket is closed, do closed at - opened at else if it the ticket is open, do TodaysDate - opened at.
Solved! Go to Solution.
@PPStar try below
Duration =
IF (
NOT ISBLANK('Ticket'[Closed Date]),
'Ticket'[Closed Date] - 'Ticket'[Opened Date],
TODAY() - 'Ticket'[Opened Date]
)
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!
Hi @PPStar ,
Have you solved your problem? If it's solved, you can mark the correct answer, if not, provide more detailed information and we can help you better!
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@PPStar try below
Duration =
IF (
NOT ISBLANK('Ticket'[Closed Date]),
'Ticket'[Closed Date] - 'Ticket'[Opened Date],
TODAY() - 'Ticket'[Opened Date]
)
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!
If ([States] = closed then [closed_at]-[opened_at] else DateTime.LocalNow - [opened_at])
I have that above formula, but i keep getting a syntax error.
note, closed at and opened at are just date column (not time). Could that be the issue
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!