# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
Contributor II

## 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

5 Replies
Contributor

## Re: Calculate measure 4 months backward?

i.e.

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

Contributor II

## 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

Honored Contributor II

## 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)

Contributor

## 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)

Valued Contributor II

## Re: Calculate measure 4 months backward?

Try

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