Looking for a BAQ Calculation

I’m looking for a BAQ calculation that will return the last of the week. I see the BAQ Constants, but I would like to calculate the day of of the week for captured dates.

Are you looking for a number (0-6, 1-7), or a string (Su, Mo, Tu, We, etc…)?

And exactly what does “return the last of the week.” mean? Last day of the week the current date is in?

I am working with labor records field Clock in Date. I am building a query to show activity “week ending”
Looking to show last day of week “Saturday” as a date.

``````dateadd(day, 7-DATEPART(weekday, POHeader.ChangeDate), POHeader.ChangeDate)
``````

gives you …

I am working with labor records field Clock in Date. I am building a query to show activity “week ending”

Looking to show last day of week “Saturday” as a date.

Want to create a calculated field to show Monday as Saturday (date), Tuesday as Saturday (date) ect.

Ahh, I see it. That makes sense.
Thanks

The calc field uses to functions

``````DATEPART(weekday, POHeader.ChangeDate)
``````

To determine the day of the week (Sun = 1, Saturday is 7)

``````7 - DATEPART(weekday, POHeader.ChangeDate)
``````

is how many days need to be added to the date to get to Saturday

``````dateadd(day, days_to_add, date_to_add_them_to)
``````

gives yoy the date for the following Saturday

1 Like

Thanks

I use this to find the Friday of the week ( that is why when datepart(weekday,JobHead.ReqDueDate) = 6 is missing. Just add 1 to the then dateadd(day, 5 change this to 6 to get Sat

(case