Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
vengadeshpalani
Creator
Creator

If condition Issue

IDIS_AMIIS_PlannedM_id
9YP1
9NP2
9YP3
9P4
8YP5
9NO6
9NO7
9YO8
9YP9
9YP10

if(ID=9 and IS_AMI ='Y','AMI',

     if(ID=9 and IS_AMI ='N','NonAMI',

          if(ID=9 and IS_planned='P','Planned'))) as restorecode


Dim: restorecode

Expression : count(M_id)



Result in bar chart :

AMI = 5

NonAMI= 3

Planned = 6 (but it show 1)


how to change "if conditions" for correct result




1 Solution

Accepted Solutions
sunny_talwar

Try this

Table:

LOAD RowNo() as Key,

  *;

LOAD * INLINE [

    ID, IS_AMI, IS_Planned, M_id

    9, Y, P, 1

    9, N, P, 2

    9, Y, P, 3

    9, , P, 4

    8, Y, P, 5

    9, N, O, 6

    9, N, O, 7

    9, Y, O, 8

    9, Y, P, 9

    9, Y, P, 10

];

LinkTable:

LOAD Key,

  'AMI' as restorecode

Resident Table

Where ID = 9 and IS_AMI = 'Y';

Concatenate (LinkTable)

LOAD Key,

  'NonAMI' as restorecode

Resident Table

Where ID = 9 and IS_AMI = 'N';

Concatenate (LinkTable)

LOAD Key,

  'Planned' as restorecode

Resident Table

Where ID = 9 and IS_Planned = 'P';

Capture.PNG

View solution in original post

2 Replies
ahaahaaha
Partner - Master
Partner - Master

May be

if(ID=9 and IS_AMI ='Y','AMI',

    if(ID=9 and IS_AMI ='N','NonAMI',

          if(ID=9 and IS_planned='P' and IS_AMI ='N','Planned'))) as restorecode

sunny_talwar

Try this

Table:

LOAD RowNo() as Key,

  *;

LOAD * INLINE [

    ID, IS_AMI, IS_Planned, M_id

    9, Y, P, 1

    9, N, P, 2

    9, Y, P, 3

    9, , P, 4

    8, Y, P, 5

    9, N, O, 6

    9, N, O, 7

    9, Y, O, 8

    9, Y, P, 9

    9, Y, P, 10

];

LinkTable:

LOAD Key,

  'AMI' as restorecode

Resident Table

Where ID = 9 and IS_AMI = 'Y';

Concatenate (LinkTable)

LOAD Key,

  'NonAMI' as restorecode

Resident Table

Where ID = 9 and IS_AMI = 'N';

Concatenate (LinkTable)

LOAD Key,

  'Planned' as restorecode

Resident Table

Where ID = 9 and IS_Planned = 'P';

Capture.PNG