Calculating Week diffrence in Query Activity | Community
Skip to main content
Level 4
December 21, 2023
Solved

Calculating Week diffrence in Query Activity

  • December 21, 2023
  • 1 reply
  • 664 views

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

 











This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Amine_Abedour

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

 

1 reply

Amine_Abedour
Community Advisor
Amine_AbedourCommunity AdvisorAccepted solution
Community Advisor
December 21, 2023

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

 

Amine ABEDOUR
vani97Author
Level 4
December 22, 2023

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