Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
How to get week start as Sunday>Below is the expression used to derive week
if(month(weekend(new_order_date))= month(new_order_date),div(day(WeekEnd(new_order_date)),7),div(day(Weekend(new_order_date,-1)),7)+1) as Week
Try setting an offset to make sunday the first day of the week:
if(month(weekend(new_order_date,0,6))= month(new_order_date),div(day(WeekEnd(new_order_date,0,6)),7),div(day(Weekend(new_order_date,-1,6)),7)+1) as Week
Try setting an offset to make sunday the first day of the week:
if(month(weekend(new_order_date,0,6))= month(new_order_date),div(day(WeekEnd(new_order_date,0,6)),7),div(day(Weekend(new_order_date,-1,6)),7)+1) as Week
Hi,
But it gives as below ,which indicates 6 weeks in an month.
Thanks..
Hi,
I have removed +1 in above expression and now its fine.
Here it gives week numbers but i need to show as Week1,week2....week4.
I have used the below,which won't work
'Week' & if(month(weekend(new_order_date,0,6))= month(new_order_date),div(day(WeekEnd(new_order_date,0,6)),7),div(day(Weekend(new_order_date,-1,6)),7)) as WeekNumber
Thanks
Hi,
I have removed +1 in above expression and now its fine.
Here it gives week numbers but i need to show as Week1,week2....week4.
I have used the below,which won't work
'Week' & if(month(weekend(new_order_date,0,6))= month(new_order_date),div(day(WeekEnd(new_order_date,0,6)),7),div(day(Weekend(new_order_date,-1,6)),7)) as WeekNumber
Thanks
Hi,
The below logic gaves as week0,week1....week4 but i need to show week1..week2.....week5
'Week' & if(month(weekend(new_order_date,0,6))= month(new_order_date),div(day(WeekEnd(new_order_date,0,6)),7),div(day(Weekend(new_order_date,-1,6)),7)) as WeekNumber
Thanks
You're welcome. If the problem is solved now please mark this discussion as answered.