Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
AB108
Contributor III
Contributor III

Calculating metric for prior year

Hi,

I am trying to calculate sum of a metric for the previous year in QlikView  pivot table.

The year is a dimension(listbox) which is selected by user-FYear

Tried a couple of combinations like below formula but not getting the results:

sum({<[FYear]={$(=Max([FYear])-1)>}[Qty]) ---gives nothing

Sum({<[FYear]={$(=AddYear([FYear],-1))}>}[Qty] )  ---gives zero

Labels (2)
2 Solutions

Accepted Solutions
srishsum2017
Creator
Creator

Try this, if its not work so please share some sample data.

sum({<[FYear]={"$(=Max([FYear])-1)"}>}[Qty])

Sumit Kumar Srivastava

View solution in original post

AB108
Contributor III
Contributor III
Author

HI Sumit, This totally worked. Thanks a lot. 

View solution in original post

4 Replies
srishsum2017
Creator
Creator

Try this, if its not work so please share some sample data.

sum({<[FYear]={"$(=Max([FYear])-1)"}>}[Qty])

Sumit Kumar Srivastava
MayilVahanan

HI @AB108

I think, your FYear looks like below

MayilVahanan_0-1614064746262.png

 

in that case, you can use Dual() function and assign numeric values for FYear and then use max() function in set analysis, hope it helps.

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
AB108
Contributor III
Contributor III
Author

HI Sumit, This totally worked. Thanks a lot. 

AB108
Contributor III
Contributor III
Author

Hi Mayil,

Fyear has straight up year values-2017,2018...

Corrected the expression, its working now.