13 Replies Latest reply: Feb 16, 2013 9:48 AM by Gysbert Wassenaar

# Rolling 12 days

Hi

I need to create formula that counts a measure the last 12 days.

It should allways be tha last 12 days even if one select other periods from timetable.

I tired this one:

=

COUNT(DISTINCT if([Date record was created.] >= date(num(today()) -12) and TO_LOCATION LIKE 'INN_MONO_0*' and ((not([UOM for FROM_QTY.] like 'RC')) and FROM_LOCATION LIKE '1*'),TO_LIC

,0))

My original formula

=

COUNT(DISTINCT if(TO_LOCATION LIKE 'INN_MONO_0*' and ((not([UOM for FROM_QTY.] like 'RC')) and FROM_LOCATION LIKE '1*'),TO_LIC

,0))

BR

Dan

• ###### Re: Rolling 12 days

The first formula looks good, if it doesn't work pay attention to date format ('DD/MM/YYYY') for example

• ###### Re: Rolling 12 days

Hi Dan,

Let try this (ignor syntax checker)

```Count(
{\$<[Date record was created.] = {">=\$(=Date(Today()-12))"},
[TO_LOCATION] = {'INN_MONO_0*'}>},
[FROM_LOCATION] = {'1*'}>},
[UOM for FROM_QTY.] -= {'*RC*'}>}
Distinct [TO_LIC])
```

Hope it help

Regards,

Sokkorn

• ###### Re: Rolling 12 days

HI i have an issue friend can u help me yarr................

• ###### Re: Rolling 12 days

Hi Sokkorn,

i am asking u man .i need quarter and previous year-quarter comparision is required,so pls help me .

• ###### Re: Rolling 12 days

Hi c vr,

Can you details your requirement? We are not clear what you looking for yet.

BTW, I have some clue below:

1. Sales for the same Month but Previous Year:

Sum(

{\$<MonthID = {\$(=Max(MonthID) – 12)},

Year = ,

Quarter = ,

Month = >} Sales)

2. Sales for same Quarter of the Previous Year:

Sum(

{\$<QuarterID = {\$(=Max(QuarterID) – 4)},

Year = ,

Quarter = ,

Month = >} Sales)

Regards,

Sokkorn

• ###### Re: Rolling 12 days

Try Below code

count({<[Date record was created.] ={">\$(=Date(addmonths(max([Date record was created.]),-12))<={\$(=Max([Date record was created.])}"},`[TO_LOCATION] = {'INN_MONO_0*'}>},    [FROM_LOCATION] = {'1*'}>},    [UOM for FROM_QTY.] -= {'*RC*'}>}`>}`Distinct [TO_LIC]`)

hope this helps

• ###### Re: Rolling 12 days

Hi

This one seems to go 12 months back, where I would need only 12 days.

Dan

• ###### Re: Rolling 12 days

Hi

This one seems to go 12 months back, where I would need only 12 days.

Dan

• ###### Re: Rolling 12 days

Hi Dan,

Count(

{\$<[Date record was created.] = {">=\$(=Date(Today()-12))<=\$(=Date(Max([Date record was created.])))"},

[TO_LOCATION] = {'INN_MONO_0*'}>},

[FROM_LOCATION] = {'1*'}>},

[UOM for FROM_QTY.] -= {'*RC*'}>}

Distinct [TO_LIC])

Regards,

Sokkorn

• ###### Re: Rolling 12 days

Hi

Thanks, still some issues, Both this got me a lot closer. Had to change the dateformat.

How do I get it to allow me to look at two from_loactions at the same time

this is the origianl:

=count( {\$<DatoKortOmv = {">=\$(=Date(Today()-12))<=\$(=Date(Max(DatoKortOmv)))"},

[TO_LOCATION] = {'INN_MONO_0*'},

[FROM_LOCATION] = {'2*'},

[UOM for FROM_QTY.] = {"*"} - {'*RC*'} >} distinct

[TO_LIC])

BUT I need something like

=count( {\$<DatoKortOmv = {">=\$(=Date(Today()-12))<=\$(=Date(Max(DatoKortOmv)))"},

[TO_LOCATION] = {'INN_MONO_0*'},

[FROM_LOCATION] = {'2*'} or [FROM_LOCATION] = {'2*'},

[UOM for FROM_QTY.] = {"*"} - {'*RC*'} >} distinct

[TO_LIC])

Gives me nothing if I do it like that.

I could just do formula1 + formula2 and just change the from_location value. But I am sure there is a better way,

Dan

• ###### Re: Rolling 12 days

[FROM_LOCATION] = {'2*'} or [FROM_LOCATION] = {'2*'}

These two conditions are identical so you need only one

But if you want something like [FROM_LOCATION] = {'2*'} or [FROM_LOCATION] = {'6*'} you can use [FROM_LOCATION] = {'2*','6*'}

• ###### Re: Rolling 12 days

Hi

This one seems to go 12 months back, where I would need only 12 days.

Dan

• ###### Re: Rolling 12 days

Hi,

Check if the attached helps