Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
Highlighted
Not applicable

expression for summation of previous 3 months columns for selected month

HI Sir,

I am developing Purchase analysis report in that I want to write expression for Consumption qty for last 3 months sum from the selected

month. for that column i have data for 12 months in terms of  columns in a table MVER from SAP database. it includes 12 columns for 12 months how to write the expression for previous 3 months qty from selected month.

Ex : I have selected Aug month then I want summation of qty for May , June , July data from that table columns

12 Replies
MVP
MVP

Re: expression for summation of previous 3 months columns for selected month

Try something like:

Sum({<Month={">$(=(Max(Month)-3))"}>}Amount)

With field data format right, this should work.

Not applicable

Re: expression for summation of previous 3 months columns for selected month

HI Sir,

But I have columns such as GSV01,GSV02,GSV03,...,GSV12 and if GSV01 is for Jan , GSV02 as feb,.....GSV12 as dec and when I select Aug then i want sum(GSV05+ GSV06+GSV07). so how i will write expression for that.

MVP
MVP

Re: expression for summation of previous 3 months columns for selected month

Please share your sample app.

Not applicable

Re: Re: expression for summation of previous 3 months columns for selected month

HI Sir,

Please find an attachment. In that I have selected 2012 JUn And particular Material Code. And I want sum of GVS03,GVS04,GVS05

AS i SELECT Jun so sum(Apr + May + June) columns. So how to write expression for that month and it will be dynamic.

yevgeniy
Contributor

Re: expression for summation of previous 3 months columns for selected month

Hi,

In you calendar, set month jan as 1, Feb as 2 .......

Set column as YearMonth: 201211,201212,20131,20132........

And Tresesco say:

Sum({<YearMonth={">$(=(Max(YearMonth)-4))<$(=(Max(YearMonth)))"}>}Amount)

Not applicable

Re: Re: expression for summation of previous 3 months columns for selected month

HI Sir,

I want the sum of data of that column not amount. Sum(GSV01+GSV02+GSV03)

MVP
MVP

Re: Re: Re: expression for summation of previous 3 months columns for selected month

Hello,

PFA, i have tried to replicate your issue and solution accordingly. Hope this would help you.

MVP
MVP

Re: Re: Re: expression for summation of previous 3 months columns for selected month

Hi Pankaj,

Did you check if the attached solution was helpful?

Not applicable

Re: expression for summation of previous 3 months columns for selected month

HI Sir,

Thankx for sample app it's working but if I selected suppose 2013 jan then I want sum of oct , nov , dec for 2012

it menas i want expression including year filter also for that also i have year field in DB but how I link this field with calender year . so how to write expression including year filter also.