Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
soniasweety
Master
Master

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
tresesco
MVP
MVP

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
tresesco
MVP
MVP

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)

...

prma7799
Master III
Master III

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)

...


jonathandienst
Partner - Champion III
Partner - Champion III

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
arvind_patil
Partner - Specialist III
Partner - Specialist III

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