# New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
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

Tags (4)
1 Solution

Accepted Solutions
MVP

## Re: Multiple If to falg

May be like:

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)

...

4 Replies
MVP

## Re: Multiple If to falg

May be like:

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)

...

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

## Re: Multiple If to falg

...

If(Time>Critical, 1,

If(Time>=Urgent, 2,

If(Time>=Normal, 3,

If(Time>=Medium, 4,

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

) as Flag,

...

 Sum({} Amount)
Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
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