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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Calculation Syntax

Hello,

I know computers follow a simple logic and usually the user causes the error but Im totally irritated

I try to do a simple calculation but QV seems to find a way I have not thought about.

I get different results when excluding a certain file in a sum-function with Set Analysis and when subtracting the sum of that value.

sum({$<CurrentYearFlag={1}, Incoterm-={FCA}>}[Total Invoice Amount])

= 10.113.047

sum({$<CurrentYearFlag={1}>}[Total Invoice Amount])-sum({$<CurrentYearFlag={1}, Incoterm={FCA}>}[Total Invoice Amount])

= 13.467.336

Can someone explain me what could be the problem with my data / Syntax that leads to different results?

Many Thanks!

5 Replies
sunny_talwar

Have you made any selections in Incoterm field when you tried to do this?

There is a difference between

Incoterm-={FCA} and Incoterm = {*} - {FCA}

Your second expression is more like this -> Incoterm = {*} - {FCA}

Anonymous
Not applicable
Author

No selections have been made.

Anonymous
Not applicable
Author

Ok, I think I found the reason.

The difference between the two formulas:

sum({$<CurrentYearFlag={1}, Incoterm-={FCA}>}[Total Invoice Amount])

sum({$<CurrentYearFlag={1}>}[Total Invoice Amount])-sum({$<CurrentYearFlag={1}, Incoterm={FCA}>}[Total Invoice Amount])

is exactly the amount of empty fields I got in [Incoterms].

But this does still not explain the two different results to me.

sunny_talwar

Still what do you get for this -> Sum({$<CurrentYearFlag={1}, Incoterm= {'*'} - {'FCA'}>}[Total Invoice Amount])

Anonymous
Not applicable
Author

same as

sum({$<CurrentYearFlag={1}, Incoterm-={FCA}>}[Total Invoice Amount])