Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

darrin_pilkingt
Not applicable

Date range in set analysis with an 'or' option?

Hello,

I have seen a lot of information on date ranges in set analysis but not quite one that could answer my question.

I am trying to count SKUs for:

ProductType = {1000,2000}

AND

StartDate <= vDate, EndDate > vDate

OR

ProductType = {1000,2000}

AND

StartDate <= vDate, len(EndDate) = 0

I hope someone can help.  I have seen If statements nested in Set Analysis and I really don't want to go down that path.

Thank you.

1 Solution

Accepted Solutions
jagan
Not applicable

Re: Date range in set analysis with an 'or' option?

Hi,

Try like this

Count({<ProductType = {1000,2000}, StartDate={'<=$(=vDate)'}, EndDate ={'>$(=vDate)'}> +

<ProductType = {1000,2000}, StartDate={'<=$(=vDate)'}, EndDate -={'*'}>} SKU)

Note : The above expression will be shown as syntax error becuase of using -= in expression,  but it works.

Hope this helps you.

Regards,

jagan.

3 Replies
mov
Not applicable

Re: Date range in set analysis with an 'or' option?

You can use set operator + for OR:

{<set modifiers> + <different set modifiers>}

jagan
Not applicable

Re: Date range in set analysis with an 'or' option?

Hi,

Try like this

Count({<ProductType = {1000,2000}, StartDate={'<=$(=vDate)'}, EndDate ={'>$(=vDate)'}> +

<ProductType = {1000,2000}, StartDate={'<=$(=vDate)'}, EndDate -={'*'}>} SKU)

Note : The above expression will be shown as syntax error becuase of using -= in expression,  but it works.

Hope this helps you.

Regards,

jagan.

darrin_pilkingt
Not applicable

Re: Date range in set analysis with an 'or' option?

Jagan and Michael, thank you both for jumping on this.  I was seeing the + operator but was also wrapping the entire set in the same outer <>. 

This is actually a great example of set analysis as it is doing many things and it's easily identifiable.

Thanks again.