Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
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.