Forum Discussion

Rosh88's avatar
Rosh88
New Member
2 years ago
Solved

Determining the Completion Date Based on the Start Date + <xx> Working Days

Hi,  I am currently working with two specific tables: a Fact Table and a Calendar Table. My objective is to accurately calculate the completion date for each entry. The formula to determine the comp...
  • talespin's avatar
    2 years ago

    hi Rosh88 

     

    I have a disconnected CALENDAR Table, please note that I have True/False(Boolean) in IsWorkingDay, you can change DAX to 'CALENDAR'[IsWorkingDay] = 1 instead of just  'CALENDAR'[IsWorkingDay]

     

    This is a calculated column

    CompletionDate =
    VAR _StartDate = 'Fact'[StartDate]
    VAR _WorkingDays = 'Fact'[WorkingDays]
    VAR _FltrTable = FILTER('CALENDAR', 'CALENDAR'[IsWorkingDay] && 'CALENDAR'[Date] >= _StartDate)
    VAR _WorkingDaysTbl =
    ADDCOLUMNS(
                _FltrTable,
                "@RANK",
                RANK(DENSE, _FltrTable, ORDERBY('CALENDAR'[Date]))
            )

    RETURN MAXX( FILTER(_WorkingDaysTbl, [@RANK] = _WorkingDays), [Date])