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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
karan_kn
Creator II
Creator II

Set Analysis AND/OR condition

Please help me on to fix this set Analysis script, type field not working when I use '+'

=Count({<type={'doc'},date={""} >+<date={">$(=Date(Today()))"}>} asset)

Type= doc

Date= Null or  >Today()

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

Something like this

If((type = 'doc' or (type = 'lib' and not folder like '%/drive/%')) and (Len(Trim(date)) = 0 or date > Today()), 1, 0) as Flag2

and then this:

Count({<Flag = {1}>} asset)

View solution in original post

7 Replies
MK_QSL
MVP
MVP

May be create a backend flag

IF(Len(Trim(Date))=0,1) as null_Date

and use as below

=COUNT({<Type = {'Doc'}>*(<null_Date = {1}>+<Date = {">=$(=Date(Today()))"}>)}Asset)


Note that Type, Doc, Date, Asset all are case sensitive.

sasiparupudi1
Master III
Master III

May be try

Count(

{

<type={'doc'},date={"=Len(Trim(date))=0"} >+

<type={'doc'},date={">$(=Date(Today()))"}>

} asset)

sunny_talwar
MVP
MVP

Extend this further may be like this by creating a new field like this

Date(If(Len(Trim(Date)) = 0, AddYears(Today(), 1), Date)) as NewDate

and then this

=Count{<Type = {'Doc'}, NewDate = {">$(=Date(Today()))"}>} Asset)

karan_kn
Creator II
Creator II
Author

Thanks, can some one help with multiple operator using Set Analysis

=Count(type='doc' or (type='lib' and folder not like '%/drive/%'))

and (date='' or date>Today) asset)

sunny_talwar
MVP
MVP

Once again, why can't you just create flags in the script? unless you have a specific reason to do this on the front end, I would suggest to create flags in the script to do this

sunny_talwar
MVP
MVP

Something like this

If((type = 'doc' or (type = 'lib' and not folder like '%/drive/%')) and (Len(Trim(date)) = 0 or date > Today()), 1, 0) as Flag2

and then this:

Count({<Flag = {1}>} asset)

karan_kn
Creator II
Creator II
Author

Perfect Thanks