Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
sibrulotte
Creator III
Creator III

Comparing sums from different tables

Hi,

I have three tables:

Requisitions, chart of account, and GL transactions. ( my document security is on business unit, and I want my managers to see all their requisitions, so I can't play around too much with the model)

requisition model.png

I want to sum for every Requisition NO the requisition amount, and compare it the amount in the GL matching the Requisition No GL.

Heres the chart expression I'm using to retrieve GL account from a chart that has Requisition dimensions:

=sum({<[Requisition NO GL] = p([Requisition NO])>} [GL ammount])

The result is in the Requisition amount chart

Requisition tables.png

I would like to find in the Requisition amount chart in the GL amount expression for SP-123: 50$

and for SP-ABC: 55$.

Anyone have a recommendation on how to get the desired result?

4 Replies
felipedl
Partner - Specialist III
Partner - Specialist III

Hi Simon,

Just change your expression to:

=sum({<[Requisition NO] = p([Requisition NO GL])>} [GL ammount])

Your expression:

=sum({<[Requisition NO GL] = p([Requisition NO])>} [GL ammount])


Is getting all possible values (marked in red bellow) twice for each [Requisition NO], since you have the association in your model and so doubling your values.

Additionally, its also getting the value for SP-789 since it's a possible [Requisition NO] value.

sample.png

sunny_talwar

Not sure, but you might be able to try this in addition to felipedl‌'s suggestion

=Sum(If([Requisition NO GL] = [Requisition NO], [GL ammount]))


Capture.PNG

sibrulotte
Creator III
Creator III
Author

Thank you both.

Felip: the expression does not return 50 and 55. Returns 105.

Sunny: That brings back in deed 50 and 55, but where's the 150 for SP-789 ?

sunny_talwar

It seems that SP-789 doesn't have a link because Business unit is null for SP-789

Capture.PNG

May be you will need to rethink the data model to get this requirement done?