Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
emmanueld
New Contributor II

Set Analysis : 2 conditions on same field

Hello everyone,

I have in my Qlikview a few set analyses having 2 conditions on the same field, like for instance "Date > X AND Date < Y", and I am wondering what is the difference between the two following syntaxes:

Date = {">=$(v_Today)"}*{"<=$(v_variable)"}

Date = {">=$(v_Today) <=$(v_variable)"}


After running a few tests, I feel like the second syntax sometimes works like an "AND" and sometimes like an "OR", why is that?


Actual case :

This seems to work (Formatted date is a YYYYMMDD-formatted string, just as the two variables, calculated in the script):

FormattedDate = {">=$(v_DateToday) <=$(v_DateSixMonths)"}


But this doesn't, it behaves like a "OR":

FormattedMonth = {">=$(=min(START_DATE)) <=$(=max(END_DATE))"}>}

and I had to correct it by

FormattedMonth = {">=$(=min(START_DATE))"} * {"<=$(=max(END_DATE))"}>}


(Formatted month is a YYYYMM-formatted string, and START_DATE and END_DATE are two YYYYMM-formatted ID fields, impacted by the selection of the equivalent labels in a Multi box)

Thanks

Tags (1)
1 Solution

Accepted Solutions

Re: Set Analysis : 2 conditions on same field

I am wondering what is the difference between the two following syntaxes:

Date = {">=$(v_Today)"}*{"<=$(v_variable)"}

Date = {">=$(v_Today) <=$(v_variable)"}

They're functionally the same. The intersection of two sets in the first is an AND and so is the second syntax.

But this doesn't, it behaves like a "OR":

FormattedMonth = {">=$(=min(START_DATE)) <=$(=max(END_DATE))"}>}

It's not an OR, it simply does not work at all and thus creates a set of all records. Why it doesn't work? Probably because the date formats of FormattedMonth, START_DATE and END_DATE differ. I consider this behavior a bug personally.


talk is cheap, supply exceeds demand
3 Replies

Re: Set Analysis : 2 conditions on same field

I am wondering what is the difference between the two following syntaxes:

Date = {">=$(v_Today)"}*{"<=$(v_variable)"}

Date = {">=$(v_Today) <=$(v_variable)"}

They're functionally the same. The intersection of two sets in the first is an AND and so is the second syntax.

But this doesn't, it behaves like a "OR":

FormattedMonth = {">=$(=min(START_DATE)) <=$(=max(END_DATE))"}>}

It's not an OR, it simply does not work at all and thus creates a set of all records. Why it doesn't work? Probably because the date formats of FormattedMonth, START_DATE and END_DATE differ. I consider this behavior a bug personally.


talk is cheap, supply exceeds demand
emmanueld
New Contributor II

Re: Set Analysis : 2 conditions on same field

Yes you must be right about it simply not working at all I'm surprised though if it's a formatting issue, because it works with the * in between. Thank you Gysbert for your clarification.

Re: Set Analysis : 2 conditions on same field

Yes, that's why I consider it a bug. Comparisons using >, >=, < and <= should always use the numeric values. Formatting of the dual value shouldn't make a difference imho.


talk is cheap, supply exceeds demand
Community Browser