Skip to main content

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Qlik Cloud Maintenance is scheduled between March 27-30. Visit Qlik Cloud Status page for more details.
Showing results for 
Search instead for 
Did you mean: 

GetFieldSelection Previous Year Value

I am using GetFieldselction function and getting the value of Filtered year using below formula.


Sum({<[MonthYear]={"$(=GetFieldSelections(MonthYear))"}>}[Total Income])/1000000  --This gives me Filtered year value correctly


Now, based on filter selction, for example if I choose filter as Oct-22, I would like to get Oct-21 values in other field.

I tried the below but it doesn't work.

Sum({<[MonthYear]={"=$=AddYears(=GetFieldSelections(MonthYear)),-1)"}>}[Total Income ])/1000000.


Can anyone please tell me how to get previous year value based on filter selection using "GetFieldselction"?

Labels (1)
1 Reply

Consider adding a serial date field to your master calendar: Autonumber(MonthYear) as _YM_Serial. Make sure your calendar is ascending sorted.

Then calculate like this:

Sum({<_YM_Serial = {$(=Max(_YM_Serial))}>}[Total Income]).


Sum({<_YM_Serial = {"=$(=Max(_YM_Serial)-1)"}>}[Total Income]) for the previous year.

Selecting okt 2022 will yield that result. Selecting oct 2021 will yield that months result since your calendar would like something like this:

MonthYear , _YM_Serial

oct. 2021 , 1

oct. 2022 , 2