Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello all,
What is the code to create a rolling 12 months flag in the script?
I currently have a Master Calendar and would like to add it to the table but not sure how to create it.
Hi Sunny,
This doesn't quite work because it does Feb 2017 and includes Jan 2018.
I want it to be ALL of January, up to the end of Dec 2017.
So it should not include the current month.
How about this
If(DateField >= MonthStart(Today(), -12) and DateField < MonthStart(Today()), 1, 0) as R12M_Flag
Hi Sunny,
Will this include data from the start of the month 12 months ago? i.e. From January 1st? Or Feb 1st? Mar 1st? etc naturally?
This almost work I just want to check the above!
MonthStart should take your to the beginning of the day... so since today is Jan 15th... we should see this from the above
>= 01/01/2017<01/01/2018
here 01/01/2018 won't be included as we have used less than (and not less than equal to)
So if I use <= it will include data from the first day of each month?
No that is not what I meant.... what I trying to say is that since today is Jan 2018... you hopefully want to just include until the last day of Dec 2017, right? If that is true, then the above script should work for you
Michael,
You still haven't solved this you try the following.
,InMonths(12, D, Today(), -1, num(month(Today()))) as Previous12Months