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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
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
Partner - Champion III
Partner - Champion III

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.

View solution in original post

3 Replies
Anonymous
Not applicable
Author

You can use set operator + for OR:

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

jagan
Partner - Champion III
Partner - Champion III

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.

Anonymous
Not applicable
Author

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.