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

Getting Prior Year in Set Analysis

I am stuck with a bit of set analysis. I want to display this year's and last year's totals, using year as a dimension. I can get everything but have to enter last year. I cannot get anything to work. Any help? The formula I am using is:

=Sum({1<[Sale WeekNum]={"=Week(GetFieldSelections([Sale Week Of]))"}>*(1<[Sale Year]={"=Year(GetFieldSelections([Sale Week Of]))"}> + 1<[Sale Year]={"2014"}>)}[SALE FLAG])

Again, if I replace 2014 with any formula, I lose those. I have tried many variations of {"=Year(GetFieldSelections([Sale Week Of]))-1"} to no avail. I have tried AddMonths. Thanks for your help. (I hope I have posted this in the correct place.)

2 Replies
arulsettu
Master III
Master III

try this

replace this

1<[Sale Year]={"2014"}


with this


datefield={">=$(=Num(YearStart(Max(datefield), -1)))<=$(=AddYear(Max(datefield), -1))"}

timothyj
Creator
Creator
Author

Between the time I submitted this and it was posted, I got a working solution for the previous year:

<[Sale Year]={$(=Year(GetFieldSelections([Sale Week Of]))-1)}>

I also changed:

<[Sale Year]={"=Year(GetFieldSelections([Sale Week Of]))"}>

to

<[Sale Year]={$(=Year(GetFieldSelections([Sale Week Of])))}>


I am going to have to study up on the difference between using quotation marks and dollar sign expansion in expressions.


Thanks!