3 Replies Latest reply on Nov 28, 2014 8:23 PM by Tableau kumar

# How to determine the last work day?

OK.  Identifying the previous day and filtering based on that is not that difficult, but getting to my end point that supports my business needs is eluding me.

I want to develop a dashboard that will display data by default for the last *work day*; i.e.,

If my manager logs in on Tuesday, it will show him data for Monday.

If my manager logs in on a Monday, it will show him data for a Monday.

I have holiday data available to me in as a dimension, but *cannot* figure out how to access that data within a function where I am travelling backwards in time; i.e.,

Let's say that my manager looks at the dashboard on Monday, 12.1.14.  It should show him data for Wednesday, 11.26.14, skipping Saturday and Sunday, because they are weekends, AND Friday and Thursday (11.27+ 11.28) because my holiday switch is set to true for those days.

So, gurus, how do I accomplish this?

Thanks!

• ###### 1. Re: How to determine the last work day?

If my manager logs in on a Monday, it will show him data for Friday. . . .

• ###### 3. Re: How to determine the last work day?

Use the following syntax, it will give you Prior Business Day. (This Calculations does not consider Holidays)

IF DATENAME('weekday', [Order Date] )='Saturday' THEN DATEADD('day',-1, [Order Date] )

ELSEIF DATENAME('weekday', [Order Date] )='Sunday' THEN DATEADD('day',-2, [Order Date] )

ELSEIF DATENAME('weekday', [Order Date] )='Monday' THEN DATEADD('day',-3, [Order Date] )

END