Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
PPStar
Helper IV
Helper IV

Calculate Duration for open and closed tickets

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. 

 

 

 

1 ACCEPTED SOLUTION
johnbasha33
Solution Sage
Solution Sage

@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 !!

View solution in original post

4 REPLIES 4
v-yangliu-msft
Community Support
Community Support

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.

johnbasha33
Solution Sage
Solution Sage

@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 !!

amitchandak
Super User
Super User

@PPStar , I think it better to have table calculating Active tickets, as given file, for Active/Current employees

PPStar
Helper IV
Helper IV

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

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.