Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

If Statement Syntax Issue with Bar Graph

Hi,

I currently have the below table and code in my script:

Load

if(A='Y',if(B='Y', 'Collaterally Held', 'Held'),if(IsNull(C),'Not Held & Never Held', 'Not Held & Has Been Held')) as [Held State]

ABC
YY12/08/2015
YY12/08/2015
YY12/08/2015
YN12/08/2015
YN12/08/2015
NN12/08/2015
NN
NN
NN
NN

This creates a nice bar chart as follows:

Capture.PNG

So it's Collaterally Held when A is 'Y' and B is 'Y', and Held when A is 'Y' and B is 'N'. However I want the following change:

Held should be just when A is 'Y'. So everything would be the same, except Held would now have a value of '5'.

I haven't been able to get this to work so far. The 3rd and 4th columns work fine.

Any help would be much appreciated.

Kind regards,

Tristan

1 Solution

Accepted Solutions
sunny_talwar

May be this:

Table:

Load *,

          if(A='Y', 'Held', if(IsNull(C),'Not Held & Never Held', 'Not Held & Has Been Held')) as [Held State]

FROM source;


Concatenate (Table)

Load *,

          'Collaterally Held' as [Held State]

FROM source

Where A = 'Y' and B = 'Y';

View solution in original post

5 Replies
sunny_talwar

Seems like you don't want Collaterally Held anymore? If that's true, try this:

Load

if(A='Y',if(B='Y', 'Held', 'Held'),if(IsNull(C),'Not Held & Never Held', 'Not Held & Has Been Held')) as [Held State]

sunny_talwar

Or this:

Load

if(A='Y','Held', if(IsNull(C),'Not Held & Never Held', 'Not Held & Has Been Held')) as [Held State]

Not applicable
Author

Hi Sunny,

Thanks for the response!

I would still like Collaterally Held if possible. So the same four columns as shown, but with Held as just when A is 'Y'.

sunny_talwar

One row will only be able to take one value for a particular columne, either Collaterally Held or Held. May be add extra rows when A ='Y' and B = 'Y' as Held.

sunny_talwar

May be this:

Table:

Load *,

          if(A='Y', 'Held', if(IsNull(C),'Not Held & Never Held', 'Not Held & Has Been Held')) as [Held State]

FROM source;


Concatenate (Table)

Load *,

          'Collaterally Held' as [Held State]

FROM source

Where A = 'Y' and B = 'Y';