Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Time between dates using three columns

Hi experts,   I have the following data:     I want to create a calculated column (either in PQ or DAX - whatever is most suitable) to calculate tenure in months based on Last Hire Date. H...
  • Arul's avatar
    3 years ago

    Anonymous ,

    try this DAX formula,

    Tenure in Months = 
    IF (
        'Table'[Last Hire Date] > 'Table'[Termination Date],
        DATEDIFF ( 'Table'[Hire Date], 'Table'[Termination Date], MONTH ),
        DATEDIFF ( 'Table'[Last Hire Date], 'Table'[Termination Date], MONTH )
    )
    

    Thanks,

    Arul