I have been thinking/needing this solution for about a week. I need to adjust to a Friday-Thursday week, which I have done successfully thanks to your formula, but I guess I don't completely understand what this formula is doing. Maybe you could shed some additional light?
Here is what I am using and it seems to work...
datevar adjusted;
if dayofweek({CUSTPROB.ADDDTTM})=1 then adjusted:=date({CUSTPROB.ADDDTTM})-0 else
adjusted:=date({CUSTPROB.ADDDTTM}-dayofweek({CUSTPROB.ADDDTTM}))+6 ;
I then convert ToText in order to group.
Just looking at the first part of the if, my understanding of this is: if your date is sunday, subtract 6, this will give you Monday of the previous week.
When I tried to translate this to getting Friday of the previous week, I used -2, but this in fact gave me Wednesday, so I subtracted a couple less 'days' and this gives me friday. (I know -0 looks really stupid, I will probably take it out after you chide me about it...) What is the formula really doing?
Thanks for any help!