Forum Discussion

akhaliq7's avatar
akhaliq7
Post Prodigy
3 years ago
Solved

Get duration from two date columns

Need help to find the duration in days between two date fields.

 

Table[Date1], Table[Date2]

2 Replies

  • Vijay_A_Verma's avatar
    Vijay_A_Verma
    Most Valuable Professional

    Use following

    = Duration.TotalDays([Date2]-[Date1])
  • akhaliq7 

    You can use datediff in sql or this Dax measure:

    Measure =
    DATEDIFF(<Date1>, <Date2>, <Interval>)

    also this may help you :


    EVALUATE VAR StartDate = DATE ( 2019, 07, 01 ) VAR EndDate = DATE ( 2021, 12, 31 ) RETURN { ( "Year", DATEDIFF ( StartDate, EndDate, YEAR ) ), ( "Quarter", DATEDIFF ( StartDate, EndDate, QUARTER ) ), ( "Month", DATEDIFF ( StartDate, EndDate, MONTH ) ), ( "Week", DATEDIFF ( StartDate, EndDate, WEEK ) ), ( "Day", DATEDIFF ( StartDate, EndDate, DAY ) ) }