# QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
On May 18th at 10AM EDT we will answer your QlikView questions live. REGISTER
cancel
Showing results for
Did you mean:
Specialist II

## Sum of Sales of previous selected period.

Hi Guys,

i've some sales data structured as below:

When a user select a period (or more than one), the total Sum of sales is recalculated for the selected period.

I would like to add another column with the total sum of sales for the selected period of the previous year (2017).

So, in this case, the new column will contains the sum of 01/2017,02/2017 and 03/2017 sales.

How to achieve this ?

1 Solution

Accepted Solutions
MVP

Try this

Sum({<Year = {"\$(=Max(Year) - 1)"}, Period, Month = p(Month)>}Sales)

Where Year and Month are calculated in the script like this

Table:

Date(Date#(Period, 'MM/YYYY'), 'MM/YYYY') as Period,

Year(Date#(Period, 'MM/YYYY')) as Year,

Num(Month(Date#(Period, 'MM/YYYY'))) as Month,

IsCurrentYear,

Sales

FROM

[SampleData.xlsx]

(ooxml, embedded labels, table is Foglio1);

MVP

Try this

Sum({<Year = {"\$(=Max(Year) - 1)"}, Period, Month = p(Month)>}Sales)

Where Year and Month are calculated in the script like this

Table:

Date(Date#(Period, 'MM/YYYY'), 'MM/YYYY') as Period,

Year(Date#(Period, 'MM/YYYY')) as Year,

Num(Month(Date#(Period, 'MM/YYYY'))) as Month,

IsCurrentYear,

Sales

FROM

[SampleData.xlsx]

(ooxml, embedded labels, table is Foglio1);