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

Announcements
AWS Degraded - You may experience Community slowness, timeouts, or trouble accessing: LATEST HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

if and 'and condition'

hi,

i am using if and 'and condition'. when i ise 2 and condition, output comes correct. howevr, when i use the 3rd condition, i dont get any output

=if(GetFieldSelections(Region)='EMEA' AND GetFieldSelections(Domain)='MOPS' AND GetFieldSelections(Domain)='Reports',3.67) 

help on this would be appreciated

17 Replies
Not applicable
Author

wild match is acting as an or which is not solving my issue., i am looking for an "and".....

if(GetSelectedCount(Region)=0 AND WildMatch(GetFieldSelections(Domain),'*MOPS*','*Reports*') ,10.00,
if(GetSelectedCount(Region)=0 AND GetFieldSelections(Domain)='MOPS',8.00,



if both mops and reports are selectted then output should be 10 and if only mops is selected then output should be 8.

Anonymous
Not applicable
Author

Yep so you'll have to move the expression around a bit...

if(GetSelectedCount(Region)=0 AND GetFieldSelections(Domain)='MOPS',8.00,

if(GetSelectedCount(Region)=0 ANDWildMatch(GetFieldSelections(Domain),'*MOPS*','*Reports*') ,10.00,

Not applicable
Author

lol..i believe i had to tell the entire story rather thn breaking it ,here is the complete set and problem

if(GetSelectedCount(Region)=0 AND GetFieldSelections(Domain)='MOPS',8.00,

if(GetSelectedCount(Region)=0 ANDWildMatch(GetFieldSelections(Domain),'*MOPS*','*Reports*') ,10.00,

if(GetSelectedCount(Region)=0 ANDWildMatch(GetFieldSelections(Domain),'*WEB*','*Reports*') ,13.00,


NOW if value web and reports are selected, it gives the output as 10 instead of 13. how to fix this.


really appreciate your assistance and patience.

Anonymous
Not applicable
Author

You'll have to add some logic to say that it's NOT WildMatch(GetFieldSelections(Domain),'*WEB*') in the second line. That should take care of it, unless there are other values you need to exclude.

Not applicable
Author

overall there are 3 conditions:

if(GetSelectedCount(Region)=0 AND GetFieldSelections(Domain)='MOPS',8.00,

if(GetSelectedCount(Region)=0 ANDWildMatch(GetFieldSelections(Domain),'*MOPS*','*Reports*') ,10.00,

if(GetSelectedCount(Region)=0 ANDWildMatch(GetFieldSelections(Domain),'*WEB*','*Reports*') ,13.00

if(GetSelectedCount(Region)=0 ANDWildMatch(GetFieldSelections(Domain),'*WEB*','*MOPS*') ,13.00


i know this is getting difficult. wish qlikview was as simple as excel. simply if(and would have worked. banging my head since the last 2 hours on this

Anonymous
Not applicable
Author

OK - so you can use (concat(DISTINCT Domain, ',') like '*MOPS*' and concat(DISTINCT Domain, ',') like '*Reports*')

This would essentially do the same thing as GetFieldSelections... It will only bring back the selected fields in Domain. Try it out.

EDIT: I think that using concat will also put the values in alphabetical order so you can use like 'MOPS, Reports'

Not applicable
Author

IT WORKED only with the second listbox ..but ii have to select one field from 1st lixbox also..that combination is giving a wrong output

=if(concat(DISTINCT Domain, ',') like '*MOPS*' and concat(DISTINCT Domain, ',') like '*Reports*' and GetFieldSelections(Region)='APAC' ,10,12)

Anonymous
Not applicable
Author

You can use a combination of those functions to get exactly what you're looking for. Just make sure to use parenthesis to enclose certain logic if you get really deep into the weeds.