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: 
Rajkumar
Creator
Creator

How to get value from previous Year value in Pivot Table

Hi Everyone,

Here I have a name field, I wanted to show previous value in name if the value not present in the current year.

Any help would be appreciated.

Sales:
load * inline [
Year,Sales,Name
2016,20,1
2017,30,1
2018,50,1
2019
];

Current Year: Sum(Sales)

Previous Year: Sum(Sales)-before(Sum(Sales))

 

clipboard_image_0.png

 

regards

Raj.k

Labels (1)
6 Replies
StarinieriG
Partner - Specialist
Partner - Specialist

Hi,

 

try to add this part on the script:

 

Left Join (Sales)
LOAD
Year+1 AS Year,
Sales AS Sales_p
Resident Sales
;

 

So, use Sum(Sales_p) instead of Before function

Rajkumar
Creator
Creator
Author

My requirement is to achieve in front end.Do you have any suggestion to achieve this in front end?

OmarBenSalem

U can't get it since 2019 is NOT linked to any NAME; thus there is no PREVIOUS SALES for it.

Rajkumar
Creator
Creator
Author

Yes I can understand , But any workaround for this?

anushree1
Specialist II
Specialist II

Please check the attached

Rajkumar
Creator
Creator
Author

@OmarBenSalem  Please suggest a solution if it is feasible.