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: 
Not applicable

Combining logical operators in set analysis

The following expression works OK but does not handle cancelled invoices (where [Invoice State] = 'Cancelled')
 

sum({$<[Invoice Posted Date] = {"<=$(vReportdate)"}>}[Invoiced QTY])

The problem is that even if they are cancelled I need to include them if [Cancelled Date] > vReportdate

I need to build in the logic:

[Invoice State] <> 'Cancelled' or ([Invoice State] = 'Cancelled' AND  [Cancelled Date] > vReportdate)

or written another way

NOT( [Invoice State] = 'Cancelled' and [Cancelled Date] <= vReportdate)

The report date can be amended by the end user to be any date in the past or it defaults to today

Can anyone help please?

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Create the two elements in <> brackets and union them:

sum({$<[Invoice Posted Date] = {"<=$(vReportdate)"}, [Invoice State] -= {'Cancelled'}> +

      <[Invoice State] = {'Cancelled'}, [Cancelled Date] = {"<=$(vReportdate)"}>} [Invoiced QTY])

Add any extra terms to each side if required to ensure that there is no double counting.

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

4 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Create the two elements in <> brackets and union them:

sum({$<[Invoice Posted Date] = {"<=$(vReportdate)"}, [Invoice State] -= {'Cancelled'}> +

      <[Invoice State] = {'Cancelled'}, [Cancelled Date] = {"<=$(vReportdate)"}>} [Invoiced QTY])

Add any extra terms to each side if required to ensure that there is no double counting.

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
santharubban
Creator III
Creator III

Wain,

try this

sum({$<[Invoice Posted Date] = {"<=$(vReportdate)"}, [Invoice State] -= {'Cancelled'}> }  [Invoiced QTY]) +

      sum({$<[Invoice State] = {'Cancelled'}, [Cancelled Date] = {"<=$(vReportdate)"}>} [Invoiced QTY])

Not applicable
Author

Thanks Jonathan for your quick reply. I will try that now.

Not applicable
Author

Thanks Santharubban as well