Expand my Community achievements bar.

# Adobe Campaign Classic v7 & Campaign v8

SOLVED

## Calculating Week diffrence in Query Activity

Level 4

Hi
Actually there is requierment like week based need to send Email to recipient

and i have a Date field which has date datatype

Need to calcluate the week difference in number

If the order date is 11/23//2023

So currently they are in 4 th week difference like wise i need to fetch the week based data to current date value up to 13 weeks

So, can anyone provide a step-by-step procedure for achieve this?

I tried this but its getting week difference

vice versa

1 Accepted Solution

Hello @vani97

You can use the bellow expression :

``DaysDiff(TruncWeek(GetDate()),TruncWeek(@created))/7``

the expression calculates the number of days betwen the first day of current week and the first day of the week of @created date, and devide this number of days by 7 to get the number of weeks.

exemple of query :

result of this query :

Br,

Amine

2 Replies

Hello @vani97

You can use the bellow expression :

``DaysDiff(TruncWeek(GetDate()),TruncWeek(@created))/7``

the expression calculates the number of days betwen the first day of current week and the first day of the week of @created date, and devide this number of days by 7 to get the number of weeks.

exemple of query :

result of this query :

Br,

Amine

Level 4

Hi @Amine_Abedour

Thats Working Fine
But as per my requierment If the Date value is December 1 means so currently they are in 1 st week from the december 1 if its december 9 means they are in 2 in week in difference

But I Tried your approach but getting like if the date value is the same december 1 means Geting those date values in 3rd week diffrence

Kindly help on this