Forum Discussion

Dnaimool's avatar
Dnaimool
Regular Visitor
6 years ago

Calculating the difference between a date measure [Selected Date] and a date column in a Table

I would like to create a dax measure which calculates the difference in days between the maturity date column and the [selected date measure] so that I may have a value for each row that I can filter by

This is what I have thus far

Days to Maturity = DATEDIFF(MAX(Investments[Maturity].[Date]),[Selected Date],DAY)

 

 
 

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable
    First check what is selected date measure is returning.
    I assume you are using after before or between data slicer from date table which is not linked with the any other table.

    Create measure to calculate days as below
    No.of days= datediff(max(investment[maturity]),min(date[calendarDate]),days)
    Here i assumed you are using calender date column from date table in slicer and set it to "after" slicer.

    Thanks
    Pravin

    If it resolves your problem mark it as a solution and give Kudos.
  • Try

    Days to Maturity =

    var _max = maxx(date,date[date]) //maxx(allselected(date[date]),date[date])

    return

    MAXx(Investments,DATEDIFF(Investments[Maturity]),[Selected Date],DAY)