Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I am having a date filed from it I got month quarter and year but unable to get weekend date
my weekend date will Friday in every week.
for example today is 6/10/2014
my week end date will be 6/13/2014
and after getting the week end day i need to create a filed for calculating current 12 weeks i.e 6/13/2014 - 12 weeks.
can anyone help me in this thanks in advance.
You can use the Weekend function and subtract it by 2 to get friday like:
=date(floor(WeekEnd(DateField))-2)
Not sure how you want to implement your 12 weeks.
Maybe like:
=date(floor(WeekEnd(today()))-2-7*12)
This will give you the date 12 weeks from the end of this week
Hope this helps!
EDIT: Actually this would depend on how you calculate weekend. What would Sundays weekend be? what about Saturday? or will these values not be included?
Something like below ?
Temp:
Load
Date('01/01/2014') as MinDate,
Date('31/12/2014') as MaxDate
AutoGenerate 1;
Let vMinDate = NUM(PEEK('MinDate',0,'Temp'));
Let vMaxDate = NUM(PEEK('MaxDate',0,'Temp'));
Drop Table Temp;
Calendar:
Load
*,
IF(WeekDay(Date)=4,Date) as FridayDate;
Load
Date($(vMinDate) + IterNo() - 1) as Date
AutoGenerate 1
While $(vMinDate) + IterNo() - 1 <= $(vMaxDate);
You can use the Weekend function and subtract it by 2 to get friday like:
=date(floor(WeekEnd(DateField))-2)
Not sure how you want to implement your 12 weeks.
Maybe like:
=date(floor(WeekEnd(today()))-2-7*12)
This will give you the date 12 weeks from the end of this week
Hope this helps!
EDIT: Actually this would depend on how you calculate weekend. What would Sundays weekend be? what about Saturday? or will these values not be included?
Hi thank you for the response Weekend function worked for me.
but here in the recent 12 weeks i need to show all the two weeks which are in that
for example
is12weeks (filedname)
3/21/2014
3/28/2014
4/4/2014
4/11/2014
4/18/2014
4/25/2014
5/2/2014
5/9/2014
5/16/2014
5/23/2014
5/30/2014
6/6/2014
6/13/2014
when i use =date(floor(WeekEnd(today()))-2-7*12) i am getting only 3/21/2014 in the filed.
can you help how can i get all the current 12 weeks in the field.
in the same way i need to get the YTD and QTD functions.
thank you very much for your help.
hi thank you for your response.
I did not try your method actually i got for the weekdate by using WeekEnd([Date],0,5) as WeekDate,
Didn't even see those extra parameters to Weekend function haha.
For the 12 weeks, you just want to generate the dates of those weekending dates?
You can do an autogenerate like:
Weeks:
Load
date(floor(WeekEnd(today(),0,5))-7*(13-Iterno())) as Date
AutoGenerate(1)
while Iterno() <=13;
If this isn't want you wanted, can you explain it a little more? Is there some linking you need?
Thanks!