Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
NewbieJono
Post Partisan
Post Partisan

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 would like to find out Friday's date

 

i have markers of 1's for all working days

1 ACCEPTED SOLUTION
shafiz_p
Super User
Super User

@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

shafiz_p_0-1720122526270.png


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

View solution in original post

4 REPLIES 4
shafiz_p
Super User
Super User

@NewbieJonoUse the given code to find out last working date :

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

Hope this help🙂

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

 
Anonymous
Not applicable

Hi,@shafiz_p 

Thank you for sharing, it is very helpful to our community, hope your life goes well.

 

Best Regards,

Leroy Lu

please reply in the original thread.

shafiz_p
Super User
Super User

@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

shafiz_p_0-1720122526270.png


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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.