Forum Discussion

ghouse_peer's avatar
ghouse_peer
Post Patron
6 years ago
Solved

Duration Days

Hello guys,              I need to calculate and display the duration days. The calculation is  I have a 2 tables: 1) 'Dates' table (created using calendarauto())                          2) 'Tic...
  • mahoneypat's avatar
    mahoneypat
    6 years ago

    The first block of M code is not a measure but an example of how to create the Duration column.  Basically, in the query editor on the Add Column tab, click on Custom Column and then put an expression like this in the pop up box, substituting your actual column names in.

     

    = if [Ticket Closed Date] = null then Duration.TotalHours([Restored Date]-[Ticket Opened Date])/24 else Duration.TotalHours([Ticket Closed Date]-[Ticket Opened Date])/24

     

    Then, hit Close & Apply to load the data with the new column, and then click on New Column in the ribbon and enter the DAX expression to get your new Days Range column (follow the pattern started to add more date ranges). 

     

    Regards,

    Pat