Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Calculate difference between dates, use TODAY for blanks

Hi Experts,

 

I want to calculate Tenure in months and have a Tenure start date column and a Termination date column. 

 

If the termination date column is blank, I want to calculate the number of months between tenure start date and today. 

 

The output would be like: 

 

Any ideas for a nice DAX formula?

 

Best,

Soph

  • Anonymous  TRy this DAX Column:

     Tenure Month = 

    VAR NewTermDate  = IF(TerminationDate=BLANK(), TODAY(),TerminationDate)

    RETURN DATEDIFF(Tenure Start Date, NewTermDate, MONTH)

     

1 Reply

  • Anonymous  TRy this DAX Column:

     Tenure Month = 

    VAR NewTermDate  = IF(TerminationDate=BLANK(), TODAY(),TerminationDate)

    RETURN DATEDIFF(Tenure Start Date, NewTermDate, MONTH)