Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Analysis Questions: Cumulative function in the past

Hello,

I want to compare a period of this year with the same period last year.

For example: Jan, Feb, Mrt 2014 vs Jan, Feb, Mrt 2013.

I have now the following, but it doesn't work proper:

sum({$<Date = {">=$(=Date(addyears(Min(Date), -1)))"}, Date -= {"<=$(=Date(addyears(Max(Date), -1)))"}>}visitors)


It is on expressions level and has to work wiht selections.


Can you give a suggestion what to change?


Thanks,

Marc

9 Replies
Not applicable
Author

Hi Dariusz,

I look into your answer. And use these functions, but it didn't work. I must also use selections on Date,MonthYear, Year.

Can anyone help my furhter?

Regards,

Marc

Not applicable
Author

try this:

sum({$<Date = {">=$(=Date(addyears(Min(Date), -1)))<=$(=Date(addyears(Max(Date), -1)))"}>}visitors)

Not applicable
Author

This works for the date selction, but not for the MonthYear, Year selection. Is that also possible?

Not applicable
Author

Soory, the date function look likes it work but it doesn't. It gives the same result as current year selection.

Not applicable
Author

Marc,

the best idea for those type of questions is to attach sample application. It will let somebody to see your data model, data, etc. It is much easier to help.

Regards

Darek

Not applicable
Author

The one which works now is:

sum({$<date = {">=$(=date(addyears(Min(date), -1))) <=$(=date(addyears(Max(date), -1)))"},

antoniotiman
Master III
Master III

Marc,

try to replace sum({$<date... with sum({1<date...

preminqlik
Specialist II
Specialist II

you are almost there , you have to ignore the selections , since you already used the field named "Date" see below

sum({$<Date = {">=$(=Date(addyears(Min(Date), -1)))<=$(=Date(addyears(Max(Date), -1)))"},Year=,Month=,Quarter=>}visitors)