Forum Discussion
Previous Day function (only weekdays)
- Anonymous5 years ago
Hi Sachy123 ,
I think what you need to judge is the weekday of date. If it is Monday ,you shifts the date by -3;Other date of weekdays ,shifts the date by -1.
Previous Business Price =
VAR BackDays= If ( WEEKDAY ( SELECTEDVALUE ( BusinessDayCalendar[Date] ),2 ) = 1, -3, -1)
RETURN
CALCULATE(SELECTEDVALUE(BusinessDayCalendar[Current Price]),DATEADD(BusinessDayCalendar[Date],BackDays,DAY))
WEEKDAY ( SELECTEDVALUE ( BusinessDayCalendar[Date] ),2 ) = 1 is mean that the return value of Monday is 1 .
Then you can judge if return value=1,will shift by -3;Otherwise ,shift by -1.
The effect is as shown:
Best Regards
Community Support Team _ Ailsa Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Sachy123 ,
I think what you need to judge is the weekday of date. If it is Monday ,you shifts the date by -3;Other date of weekdays ,shifts the date by -1.
Previous Business Price =
VAR BackDays= If ( WEEKDAY ( SELECTEDVALUE ( BusinessDayCalendar[Date] ),2 ) = 1, -3, -1)
RETURN
CALCULATE(SELECTEDVALUE(BusinessDayCalendar[Current Price]),DATEADD(BusinessDayCalendar[Date],BackDays,DAY))
WEEKDAY ( SELECTEDVALUE ( BusinessDayCalendar[Date] ),2 ) = 1 is mean that the return value of Monday is 1 .
Then you can judge if return value=1,will shift by -3;Otherwise ,shift by -1.
The effect is as shown:
Best Regards
Community Support Team _ Ailsa Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.