Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to sum all last year

I want to sum all last year.what should i do.

14 Replies
Not applicable
Author

i use this

sum( {$<IvAndTar_YearINVOICEDATE={'$(Y1)'} >} IvAndTar_IV_QTY )

Y1==date(AddYears(date#(IvAndTar_YearINVOICEDATE,'YYYY'),-1),'YYYY')

that code just sum last one year can you suggest me how can i sum all last year.

sunny_talwar

Try using this for your variable Y1

Y1 = Year(AddYears(YearStart(IvAndTar_YearINVOICEDATE),-1))


and instead of matching it with a Date field, create a year field in the script and match it with that year field (you might be able to simplfy your variable once you create a year field).


Best,

S

Not applicable
Author

you can also use,

if(field_name=last year,sum(value_field))

Not applicable
Author

if my date format is 'MM-YYYY' it ok? if ido that?

Not applicable
Author

for that you need to convert data format.