Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Honored Contributor

create flags (dynamically) depending on year

Hi Folks, i got a question to issue: how to create the flags depending on selection of year ( dynamically),

i posted last week my previous issue: "wildmatch for bulding of flags", where i created the flags with the help of function:Wildmatch() and it does work great.

My now situation does look like: i have the following fields within my table

MyDate,     Type,     Sales

01.02.2018    100     5

01.04.2018    110     5

03.06.2019     200     2

06.06.2019     210     4

10.10. 2019    300     5


on tha base of this fields i created the following flags:

if(wildmatch(Type, '*100*','*110*','*200*'), 'db1',

if(wildmatch(Type, '*210*'), 'db2',

if(wildmatch(Type, '*300*'), 'db3','rest'))) as flags

on the Userinterface (within my table) i created with set expression the following expressions:

DB1 = Sum({<Type = {"db1"}>}Sales)                                DB1 = 12

DB2 = Sum({<Type = {"db1", "db2"}>}Sales)                  DB2 = 16

DB3 = Sum({<Type = {"db1","db3"}>}Sales)                    DB = 17

all these expression do work great.


and finally my question: how can i create these expression on Userinterface (within my table) depending on year (in dynamically way),

i made the static solution in script-area by this way:


if(Year > '2018' and wilmatch(Type, '*200*'),'db1',

if(Year > '2018' and wilmatch(Type, '*210*'),'db2',

if(Year > '2018' and wilmatch(Type, '*300*'),'db3','rest'))) as flag

and use again with set expression these expression:

DB1 = Sum({<Type = {"db1"}>}Sales)                              DB1 = 2

DB2 = Sum({<Type = {"db1", "db2"}>}Sales)                DB2 = 6

DB3 = Sum({<Type = {"db1","db3"}>}Sales)                 DB3= 7


my issue is, creating the flags depending on year, in that case i select the value from year 2019, i exclude the year 2018 by static way in scrip- area.

my question is: can exclude the the values from year: 2018 in set expression and include only the values from year 2019 in dynamically way with the help of set expression.

does anybody have any idea?

i hope i explained that well enough, please let me know if you need more details. Thanks a lot in advance

2 Replies
Contributor II

Re: create flags (dynamically) depending on year


A couple of questions to better understand your requirement -

  1. Is the purpose of the DB1 flag just to group the types i.e. DB1 = '100','110','200', DB2='210', etc.?
  2. Do the above group of types change depending on the year selected or do they remain constant regardless of the Year selection? 



Honored Contributor

Re: create flags (dynamically) depending on year

Hi Chirag,

thanks a lot for your responce,


to questiion 1:  Yes, the DB1 i s the flag that Groups the type: 100, 110, 200

to question 2: my flag (above group) should Change depending on selected year (Year - Selection)

thanks a lot