Skip to main content

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Skip the ticket, Chat with Qlik Support instead for instant assistance.
Showing results for 
Search instead for 
Did you mean: 
Contributor III
Contributor III

Set analysis, 12 months prior with p() function


I have a table with the following column / measure:

Sum({$<[Order Ship MonthID]= p(MonthID), [Order Create MonthID]= p(MonthID)   >}Orders)

That is working perfect for what I want. Now I want to have the values from 12 months prior next to it.

I tried something like:

Sum({$<[Order Ship MonthID]= p($(MonthID)-12), [Order Create MonthID]= p($(MonthID)-12)  >}Orders)

Is it possible to have a calculation for all values in p()? What would be the syntax?

Thanks in advance!

3 Replies

May be create a new field in the script


          AddMonths(MonthID, -12) as PrevMonthID

and then try this

Sum({$<[Order Ship MonthID]= p(PrevMonthID), [Order Create MonthID]= p(PrevMonthID)>}Orders)

Contributor III
Contributor III

Hi Sunny, Good idea, I tried it but it plots the values not on the same line in that case. It just brings in the period of 12 months prior. I guess this makes sense, but I'd like to Jan 2017 with the values of Jan 2016 next to it. Any idea?


I would like to keep the months continuous and not discrete!


There is few ways you can handle this

1) Use The As-Of Table‌ or

2) Use Missing Manual - Above() and Below()