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: 
Luukvoskamp
Contributor
Contributor

Use of LastYTDFlag for multiple years

I`d like to make a comparison on an average for this year, 2018 and 2017.

the expression for this year is

Avg({ < CurYTDFlag = {1}, Year, YearWeek, YearMonth, Week, Month > } [Brix])

The expression for 2018 is:

Avg({ < LastYTDFlag = {1}, Year, YearWeek, YearMonth, Week, Month > } [Brix])

What expression do I have to use for a linechart to show 2017?

Labels (4)
1 Solution

Accepted Solutions
chrislemm
Partner - Contributor III
Partner - Contributor III

Inside your script you can define a new field something like

LOAD

field1,

...

fieldn,

date,

if(year(date) = year(today()) - 2, 1, 0) as TwoYearsAgoFlag

 

or in the master calendar. Inyeartodate(date, -2).

Greetings

View solution in original post

2 Replies
jfkinspari
Partner - Specialist
Partner - Specialist

Did you make the existing flags in the data model (CurYTDFlag and LastYTDFlag), or where they created by Qlik?
In any case you could make sure that another flag was created for records in 2017.
chrislemm
Partner - Contributor III
Partner - Contributor III

Inside your script you can define a new field something like

LOAD

field1,

...

fieldn,

date,

if(year(date) = year(today()) - 2, 1, 0) as TwoYearsAgoFlag

 

or in the master calendar. Inyeartodate(date, -2).

Greetings