Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

showing the last 12 months

My data source there are months and amounts since Jan/2012 as follow:

Month - Amount

Jan/2012 - 1000

Feb/ 2012 - 5000

Mar/2012 - 2000

....

Dec/2012 - 14000

I need to show a table with the values from the last 12 months consolidating.

For example :  Jan/2013 the values should be the sum(amount) from 2012 full year, in Feb/2013 the values will be the sum (amount)  from Feb/2012 by Jan/2013 ... and Dec/2013 it should be sum(amount) (Dec/2012 by  Nov/2013) .

I must show always the values within 12 months completed. As I have only amounts related to the last 12 month, I must present only Jan/13. However, next month I will be able to show Feb/13 (amount from Feb/12 by Jan/13) ....

How is the best way to do it  ? by script  ? by expression ? How ?

Please, anybody could help me ?

Thanks in advance!

2 Replies
nirav_bhimani
Partner - Specialist
Partner - Specialist

HI

Try this.

sum  ({ <Transaction_Date =   P(  { <Transaction_Date={">=$(=(Max(Transaction_Date)-365) ) <= {<CalendarYear={$(=max(CalendarYear))},CalendarMonthName={$(=Month(Max(Transaction_Date)))}>}"}>} ) >} InTotRs)
 

OR

sum({<Transaction_Date={">$(=addyears(max(Transaction_Date),-1))<=$(=max(Transaction_Date))"},YEAR=,MONTH=,Quarter=>} InTotRs)

Regards,

Nirav Bhimani

Not applicable
Author

Sorry for delay, but it worked well !!!

Thanks a lot for your support.