Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
nicogene
Partner - Contributor III
Partner - Contributor III

Last n period (trigger)

Dear all,

I try to get the last 12 periods by clicking on the tab 2 (with implementation of an action) .qvw is attached
With max formula max (Period), it works with the last period.
but max (Period-12) doesn't work.

Thank you for your help


Best regards,

Nicolas Généré.

11 Replies
Anonymous
Not applicable

Nicolas

I have adjusted you qvw and re-attached it, does it give what you were after.

I changed the field in your List Box to an <Expression>

     =  if ( aggr ( rank ( only ( Period) ) , Period ) <= 12 , Period , null() )

Best Regards,     Bill

Clever_Anjos
Employee
Employee

Try this

='<=' & date(AddMonths(max(Period),-12),'MM/YYYY')

MayilVahanan

Hi

Try like this

In action  instead of using =(max(Period)-12) , because its gives number, but we need to convert into date. For last 12 periods, i think you need last 12 months , for tat use like following.

=Date(AddYears(max(Period),-1))

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
tresesco
MVP
MVP

May be like attached sample.

qlikpahadi07
Specialist
Specialist

Hi Nicolas,

You need to write

=Date(max(Period)-365) as numbers will be taken as days not Months else you can use Set Analysis By selecting Previous Year

=max( {<Year = {$(=Max(Year)-1)} >} Period)

See the attachment

rajni_batra
Specialist
Specialist

Hello Nicolas,

please find the attched file. Hope this helps u..

Regards,

Rajni

struniger
Creator
Creator

Try using this expression: addmonths(max(Period),-12)

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Try Max(Period) - 12

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
v_iyyappan
Specialist
Specialist

Hi,

Try like this

Load

     *,

     MakeDate(Addmonths(Period, -12)) AS PriorPeroid;    

LOAD Year,

     Month,

     makedate(Year,Month) as Period,

FROM

Period.xlsx

(ooxml, embedded labels, table is Feuil1);

Regards,