Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
soniasweety
Valued Contributor III

Multiple If to falg

Hi all,

I have multiple if conditions in front end.. I want to create flag for that expressions ,how can I do that in scripting? And how can iget that flag in set analysis.

can anyone suggest the best way to do it?

1.if(Time>Critical,number,null())

2. if(Time>=Urgent and Time<=Critical,number,null())

3.if(Time>=Normal and Time<=Urgent,number,null())

4.if(Time>=Medium and Time<=Normal,number,null())

5.if(Time<=Normal,number,null())

Thanks

Sonica

1 Solution

Accepted Solutions
MVP
MVP

Re: Multiple If to falg

May be like:

Load

          If(Time>Critical, 1) as Flag1,

          If(Time>=Urgent and Time<=Critical,1) as Flag2,

          ....

Then in the front-end:

1: Sum({<Flag1={1}>}number)

2: Sum({<Flag2={1}>}number)

...

View solution in original post

4 Replies
MVP
MVP

Re: Multiple If to falg

May be like:

Load

          If(Time>Critical, 1) as Flag1,

          If(Time>=Urgent and Time<=Critical,1) as Flag2,

          ....

Then in the front-end:

1: Sum({<Flag1={1}>}number)

2: Sum({<Flag2={1}>}number)

...

View solution in original post

prma7799
Honored Contributor III

Re: Multiple If to falg

if (Time>Critical ,1,

if(Time>=Urgent and Time<=Critical ,2 ,

if(Time>=Normal and Time<=Urgent ,3,

if(Time>=Medium and Time<=Normal ,4,

if(Time<=Normal ,5 , Null() ))))) as Flag


Then use this in front end



Sum({<Flag={1}>}Sales)

...


MVP
MVP

Re: Multiple If to falg

Add this to your load script (adapted to your exact requirements):

LOAD

  ...

  If(Time>Critical, 1,

  If(Time>=Urgent, 2,

  If(Time>=Normal, 3,

  If(Time>=Medium, 4,

  If(Time<=Normal 5, null()))))

  ) as Flag,

  ...

Then your set expression becomes:

Sum({<Flag = {1}>} Amount)
Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Partner
Partner

Re: Multiple If to falg

Hi Sony,

Please use  below code in script:

if(Time>Critical,'Critical1',

if(Time>=Urgent and Time<=Critical,'UrgentandCritical2',

if(Time>=Normal and Time<=Urgent,'NormalUrgent3',

if(Time>=Medium and Time<=Normal,'MediumNormal4',

if(Time<=Normal,'BelowNormal5',null()))))) As [Flag Condition]

Thanks,

Arvind Patil