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

Previous year values table

I have this type of data

Category	Year	Revenue
Product A	2017	213
Product B	2017	345
Product C	2017	2545
Product D	2017	3455
Product A	2018	4563
Product B	2018	45677
Product C	2018	6874
Product D	2018	45366
Product A	2019	9672
Product B	2019	45782
Product C	2019	23490
Product D	2019	90124
Product A	2020	8724
Product B	2020	8728
Product C	2020	124
Product D	2020	9812

I want previous year data like this

Category	2017	2018	2019	2020
Product A	213	4563	9672	8724
Product B	345	45677	45782	8728
Product C	2545	6874	23490	124
Product D	3455	45366	90124	9812

I want previous year data like this .. I get  previous year data through this

 

 

 

Sum({$ <[Year] = {$(=Max([Year]) - 1)} >} Revenue)

 

 

formula..

 

When I click on 2020 then then 2019 fig shows as 9672 on below table (here 2020 is considered as 2019 , 2019 for 2018, 2018 for 2017 ) .. but this return only 1 year where as I want all year like below table… if you notice values is once step back from above table

Category	2017	2018	2019	2020
Product A	-	213	4563	9672
Product B	-	345	45677	45782
Product C	-	2545	6874	23490
Product D	-	3455	45366	90124
10 Replies
Brett_Bleess
Former Employee
Former Employee

If Taoufiq or Alex's posts solved your issue, please be sure to close out your thread by using the Accept as Solution button on the post(s) that helped to give them credit for the assistance and let other Members know what worked.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.