Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
cooksa
Contributor
Contributor

Expression using multiple text conditions in a chart

There are 4 text values: A, B, C and D for the field [Current Status]

In a bar chart I'm trying to combine the text values of those with A or B to be shown as 'Both' but also show those that have only A as 'Just A', which is where I'm having issues, examples of expressions below.

=if([Current Status]='A' OR [Current Status]='B','Both',if([Current Status]= 'A','Just A',[Current Status]))
//correct for Both but doesn't show Just A 

//if([Current Status]= 'A','Just A',if(([Current Status]='A' OR [Current Status]='B'),'Both',[Current Status]))
//correct for Just A but Both only displays the number in B and not the combined total

1 Solution

Accepted Solutions
MayilVahanan

Hi @cooksa 

Try like below

Create dummy field in script

Dummy:
Load * Inline
[
Dim
1
2
];
Load * Inline
[
Current Status
A
B
C
D
];

In Bar chart, try with below expression and check the "Suppress When Value is Null".

=if(Dim = 1, If([Current Status]='A' OR [Current Status]='B','Both'),if([Current Status]= 'A','Just A',[Current Status]))

Sample output:

mayilvahanan_0-1603274212162.png

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

2 Replies
MayilVahanan

Hi @cooksa 

Try like below

Create dummy field in script

Dummy:
Load * Inline
[
Dim
1
2
];
Load * Inline
[
Current Status
A
B
C
D
];

In Bar chart, try with below expression and check the "Suppress When Value is Null".

=if(Dim = 1, If([Current Status]='A' OR [Current Status]='B','Both'),if([Current Status]= 'A','Just A',[Current Status]))

Sample output:

mayilvahanan_0-1603274212162.png

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
cooksa
Contributor
Contributor
Author

Thank you, that's great