Forum Discussion

NewbieJono's avatar
NewbieJono
Post Partisan
2 years ago
Solved

Previous Working Day - Calculated coloumn

hello, in my date table, I would like to show the previous working date. I have a column that shows a marker for isWorkingDay (1,0) 

 

I need this to be a calculated column. On a bank holiday weekend, on Tuesday I would like to find out Friday's date. 

on a normal week, e.g. on a Thursday, I would like to see a Wednesday date.

 

Thank you

 

 

  • NewbieJono 

    Try the below DAX and it should provide you the desired result.


    PreviousWorkingDay =
    VAR CurrentDate = 'Table'[Date]
    VAR IsCurrentWorkingDay = 'Table'[IsworkingDay]
    RETURN

            MAXX(
                FILTER(
                    'Table',
                    'Table'[Date] < CurrentDate && 'Table'[IsworkingDay] = 1
                ),
                'Table'[Date]
            )
       

    If this post helps, then please consider Accept it as the solution to help the others find it more quickly. Appreciate you kudos!!

    Follow me on LinkedIn!!!


    LinkedIn

1 Reply

  • NaveenGandhi's avatar
    NaveenGandhi
    Memorable Member

    NewbieJono 

    Try the below DAX and it should provide you the desired result.


    PreviousWorkingDay =
    VAR CurrentDate = 'Table'[Date]
    VAR IsCurrentWorkingDay = 'Table'[IsworkingDay]
    RETURN

            MAXX(
                FILTER(
                    'Table',
                    'Table'[Date] < CurrentDate && 'Table'[IsworkingDay] = 1
                ),
                'Table'[Date]
            )
       

    If this post helps, then please consider Accept it as the solution to help the others find it more quickly. Appreciate you kudos!!

    Follow me on LinkedIn!!!


    LinkedIn