Forum Discussion

NewbieJono's avatar
NewbieJono
Post Partisan
2 years ago
Solved

Previous working date

hello, i have a date table with a marker (1,0) and I mark a working day as a 1. What do I need to do to get the previous working date.   For example   On a bank holiday weekend, on Tuesday I woul...
  • shafiz_p's avatar
    2 years ago

    NewbieJonoUse the below dax code to find out previous working date :

    LastWorkingDate =
    VAR _previousDate = CALCULATE(
        MAX('date'[Date]),
        FILTER(
            ALL('date'),
            'date'[Date] < SELECTEDVALUE('date'[Date]) && NOT 'date'[Is Workday?] IN {0}
        )
    )
    RETURN
    IF(SELECTEDVALUE('date'[Is Workday?]) = 0,_previousDate) //only showing last working date for holiday, other will be blank


    Hope this help!!
    If this answered your question, please mark it as a solution!!