Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Luukvoskamp
New 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?

1 Solution

Accepted Solutions
Highlighted
Partner
Partner

Re: Use of LastYTDFlag for multiple years

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

2 Replies
Partner
Partner

Re: Use of LastYTDFlag for multiple years

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.
Highlighted
Partner
Partner

Re: Use of LastYTDFlag for multiple years

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