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: 
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
16 Replies
PrashantSangle

Hi,

Your expression is correct.

just need to use " "

Try like

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

Also confirm Period is in date format or not.

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
senpradip007
Specialist III
Specialist III

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

Not applicable
Author

Hi Pradip,

it's not working. giving the same 0 result.

SreeniJD
Specialist
Specialist

Hi Maksood

Try this,

sum({<Year={'$(=vPYear)'},Period={'=$(=vMaxMonth)'}>}[Sum of Sales])

HTH,

Sreeni

PrashantSangle

Capture.PNG

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Anonymous
Not applicable
Author

if the period values are in text format then you need to explicitly convert it into date by using Date# function .

Hope this would work

Not applicable
Author

Hi Max,

Yes Period is in date format. still not working after applying "".

Not applicable
Author

Hi Max,

Yes Period is in date format. still not working after applying "".

Not applicable
Author

Hi Sreeni,

do I need to create vPYear and vMaxMonth? What value should I store in these vairbles?