Forum Discussion

pbi_qwerty's avatar
pbi_qwerty
New Member
1 year ago
Solved

Desperately need help with DATEDIFF calculation

Hi, I have a table like this: Vacancy Vacancy No. Job Source Sourcing channel Vacancy Source closing date Date Vacancy Source Opening Date Date Vacancy Date created Date Vacancy D...
  • Bibiano_Geraldo's avatar
    1 year ago

    Hi pbi_qwerty ,

    Please, add new calculated column using this DAX:

    DaysCreatedToOpening = 
    VAR ThisVacancy     = 'PageUp_JobSourceData_Consolidated'[Vacancy Vacancy No.]
    VAR ThisJobSource   = 'PageUp_JobSourceData_Consolidated'[Job Source Sourcing channel]
    VAR MinJobSourceForVacancy =
        CALCULATE(
            MIN( 'PageUp_JobSourceData_Consolidated'[Job Source Sourcing channel] ),
            ALLEXCEPT(
                'PageUp_JobSourceData_Consolidated',
                'PageUp_JobSourceData_Consolidated'[Vacancy Vacancy No.]
            )
        )
    RETURN
    IF(
        ThisJobSource = MinJobSourceForVacancy,
        DATEDIFF(
            'PageUp_JobSourceData_Consolidated'[Vacancy Date created Date],
            'PageUp_JobSourceData_Consolidated'[Vacancy Source Opening Date Date],
            DAY
        ),
        BLANK()
    )
    

     

    Your finally output will look like this: