Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Sam_Thomas
Creator
Creator

SUM values based on criteria being met in a different field/table

Hi All, hope you can help. 

I have 2 tables that I need to use to perform this calculation. 

[Delivery] table and [Locations] table.

The linked field is [LocationID] in the [Locations] table and [DestinationID] in the [Delivery] table. There is also a [KMSQUARED] field in the [Location] table. 

I need to SUM the values for [KMSQUARED]ONLY when the location has received a delivery. 

SUM of [KMSQUARED] if the [LocationID] appears in the Delivery table (as a [DestinationID])

I hope that makes enough sense, please ask for clarity if I haven't explained well enough. Thanks in advance for your suggestions. 

1 Reply
chriscammers
Partner - Specialist
Partner - Specialist

If we are talking about a global condition that is not dependent on users selections then I think I would pre-calculate a flag on the location table to indicate if it is a destination from the delivery table.

Or you could do something like this...

 

Sum({<LocationID = {$(=Concat(distinct chr(39) & DestinationID & chr(39),','))}>}KMSQUARED)