Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Pick Last Year Data

Hi Guys,

I have created below data in Pivot. In Growth Column What I want is Pick the value of last year which I will use in Growth Calculation.

e.g. in Sep-2014 the value should be 10820 and oct 2014 value should be 14763 and so on...

as of now I am try to find it using addyears function. Which is not giving the desire result. Please help on this.

=sum({<Period={$(=AddYears(Period,-1))}>} Sales)

 

Product1Product1Product1
PeriodSum of SalesMarket ShareGrowth
Sep-2013108202.3%0
Oct-2013147632.5%0
Nov-2013165913.3%0
Dec-2013175783.3%0
Jan-2014203183.4%0
Feb-2014164363.3%0
Mar-2014157453.0%0
Apr-2014146273.0%0
May-2014153743.1%0
Jun-2014109962.4%0
Jul-2014114002.3%0
Aug-201484462.0%0
Sep-201485241.7%0
Oct-2014159863.0%0
Nov-2014148723.0%0
Dec-2014138762.7%0
Jan-2015219103.3%0
Feb-2015208173.8%0
Mar-2015190313.3%0
Apr-2015130322.5%0
May-2015107692.1%0
Jun-201596842.0%0
Jul-201594381.8%0
Aug-201585251.8%0
Labels (1)
16 Replies
nagarjuna_kotha
Partner - Specialist II
Partner - Specialist II

Try this:


=sum({<Period={$(=date(AddYears(Period,-1), 'MMM-YYYY'))}>} Sales)

senpradip007
Specialist III
Specialist III

Have a look at this app. Hope it will help.

Not applicable
Author

Hi Pradip,

No Attachemt found.

PradeepReddy
Specialist II
Specialist II

check the 'period' is in date format or not..

can u share the app, that will be easy to others to suggest the solution..

Digvijay_Singh

You may like to create new field in backend like -

Main:

Load *,alt(peek(Product1_Sum,-12),0) as Growth resident table;

Drop table table;

SreeniJD
Specialist
Specialist

Hi Maksood,

As Digvijay suggested,

Try this script.. its working perfectly fine

Tab1:

LOAD Period,

     [Sum of Sales],

     [Market Share],

     Growth

FROM

[https://community.qlik.com/thread/184654]

(html, codepage is 1252, embedded labels, table is @1, filters(

Remove(Row, Pos(Top, 1))

));

Tab2:

Load

*, alt(peek([Sum of Sales],-12),0) as Growth1

resident Tab1;

drop table Tab1;

PrevSales.JPG

sunilkumarqv
Specialist II
Specialist II

@