Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum a value only if two fields are equal

Hi all,

  I'm running qlik sense, and I need to sul the invoice value (ImportoFattura) only if the value of two fiels "NumeroOrdine" and "NumeroSO" are equal ... this two fields belong to different tables.

I've tried reading in some blogs

  • Sum({<NumeroOrdine=P(NumeroSO)>}ImportoFattura)
  • Sum({<NumeroOrdine={"=NumeroOrdine=NumeroSO"}>}ImportoFattura)

But it doesn't work ...

By the way: I cannot load "NumeroSO as NumeroOrdine" otherwise I catch a "circular expression" error

Any Ideas ? Is it possible ?

11 Replies
swuehl
MVP
MVP

So there are at least three tables involved?

We now know a little more about your data model, but to my understanding, not enough to come up with a profound solution.

Set Analysis is all about sets (i.e. the symbol tables) and the relation of the symbols in your data model, which tables are involved and what the relation of the key fields are.

If you are really interested in the set analysis approach, you might need to post a more detailed description of your data model.

If you don't have a key field that is granular enough to put into a dimension and then Only() show unique values for both NumeroOrdine and NumeroSO fields per key dimension line in expressions, this approach will not work without creating this kind of key field (changing your model).

MaddyQlik
Contributor
Contributor

Hi, 

I have similar question, there are two tables

RI_Amount:
PolID as [RI_PolID]
,RICurrCode as [RICurrCode]
,Sum(TotalPolRIAmount) AS [RI_Amt_USD]

CY:

PolID

,EntityID

,Amount as Amt_USD

Now I have to bring RI_Amt_USD in second table CY and used

CY1:

Load *

,sum(if(RI_PolID=PolID,RI_Amt_USD))

resident CY;

but it is showing error where RI_PolID is not found or if I change back RI_PolID to PolID then error is showing RI_Amt_USD is not found.

Please help.

Madhup