5 Replies Latest reply: Nov 1, 2017 10:50 AM by Wallo Atkinson

# Calculate measure 4 months backward?

How can I calculate a measure that's always looking 4 months backwards?

i.e. October/17 in the chart needs to reflect the measure from June/17

• ###### Re: Calculate measure 4 months backward?

i.e.

Sum({\$<Month={'\$(=Month-4)'}, Month=>} YourCalculation)

• ###### Re: Calculate measure 4 months backward?

I tried the following and it didn't work:

Count({\$<IndDesemb={'S'},DtInc-={'1/1/1900'},

[DtInc.autoCalendar.Month] ={'\$(=[DtInc.autoCalendar.Month]-4)'},

[DtInc.autoCalendar.Month]=>} NroProposta)

Does it have to do with using autocalendar fields?

I also tried using the AddMonths function with no success

• ###### Re: Calculate measure 4 months backward?

Try:

Count({\$< IndDesemb={'S'}, DtInc={'1/1/1900'}, [DtInc.autoCalendar.Month]={'\$(=[DtInc.autoCalendar.Month]-4)'}>}, NroProposta)

The last part stops the calculation looking at month selection so removing this should do it.

[DtInc.autoCalendar.Month]=>} NroProposta)

• ###### Re: Calculate measure 4 months backward?

In your script create a Flag which will be Dynamic always

if(InMonth(DtInc, today() ,-4), 1, 0) as Last4Flag,

In front end use

Count({\$<IndDesemb={'S'}, Last4Flag= {1}>} NroProposta)

• ###### Re: Calculate measure 4 months backward?

Try

Count({\$<IndDesemb={'S'},DtInc-={'1/1/1900'},