Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

The 4th edition of the Campaign Community Lens newsletter is out now!
SOLVED

Query on or after 16th of every month

Avatar

Level 4

Hi Team,

 

We have a recurring campaign that runs once in a month and needs to check if a customer has an entry on or after 16th of previous month. can someone help on how to query the same, thanks in advance.

 

Thanks,

Shine v.v

1 Accepted Solution

Avatar

Correct answer by
Level 7

Hi @ShineVv0823 ,

 

Instead of going with Js calculation try this simple function in your query activity and see if this helps:

ToDateTime('"' + toString(Year(MonthsAgo(1))) + '-' + toString(Month(MonthsAgo(1))) + '-16T00:00:00.000Z')

 

_Shubham_Goyal__0-1672045945226.png

Here you use the ToDateTime function which calculates the date from the input string and in the input string you can calculate the Year of last month and the month of last month and hard code rest like 16 in your case.

See if this gives you desired results.

 

 

Br,

Shubham

View solution in original post

4 Replies

Avatar

Correct answer by
Level 7

Hi @ShineVv0823 ,

 

Instead of going with Js calculation try this simple function in your query activity and see if this helps:

ToDateTime('"' + toString(Year(MonthsAgo(1))) + '-' + toString(Month(MonthsAgo(1))) + '-16T00:00:00.000Z')

 

_Shubham_Goyal__0-1672045945226.png

Here you use the ToDateTime function which calculates the date from the input string and in the input string you can calculate the Year of last month and the month of last month and hard code rest like 16 in your case.

See if this gives you desired results.

 

 

Br,

Shubham

Avatar

Level 2

You can do what you need using the following functions:

 

Created Date     on or after   AddDays(YearAndMonth(SubMonths(GetDate(), 1)), 15)

Avatar

Level 4

@juantonio_18 , @_Shubham_Goyal_ , both of your solutions are working, thank you so much 🙂 not sure which one to mark as correct reply!! 

 

Avatar

Administrator

Hi @ShineVv0823


Wishing you a very happy new year! 🙂


In such a case, you could mark that one which you ended up using in your practice. Hope this helps resolve the confusion.

 

Thanks!