# 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.
Not applicable

## Measure based on previous month

Hi,

I need to calculate the Count(ID) for each month in the year based on previous month's Count(ID) value

MonthEnd ValueBegin Value
Jan-16100-
Feb-16200100
Mar-16300200
Apr-16400300

In the above table:

End Value = Count(ID)

Begin Value = End Value of previous month

I need to create a measure that calculates the Begin Value.

How do I achieve this in Qlik Sense?

1 Solution

Accepted Solutions
MVP

## Re: Measure based on previous month

Assuming your month fields are valid numeric date values, then you could use:

[End Value],

Previous([End Value]) as [Begin Value],

...

FROM ...

Order By Month;

If your month values are strings, convert to date values

...

Order By Date#(Month, 'MMM-yy')

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
5 Replies
New Contributor III

## Re: Measure based on previous month

Do you want to generate this measure in load script?

Not applicable

## Re: Measure based on previous month

Yes. Generating it in load script would be good.

If we can achieve this using set analysis that will also be helpful.

Honored Contributor III

## Re: Measure based on previous month

for begin value

write this expression

above(Count(ID))

MVP

## Re: Measure based on previous month

Assuming your month fields are valid numeric date values, then you could use:

[End Value],

Previous([End Value]) as [Begin Value],

...

FROM ...

Order By Month;

If your month values are strings, convert to date values

...

Order By Date#(Month, 'MMM-yy')

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable

## Re: Measure based on previous month

Hi Soumya,

Refer - Jonathan details it will work.

If not Previous then use Peek function as well.

Thank you..Ravi Kancharla

Community Browser