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: 
Meret
Partner - Contributor II
Partner - Contributor II

Conditional Expression Challenge

Hi,

I am trying to create an expression that calculates a measure depending on criteria defined by the target. The goal is a table that shows all the targets with its measures to check if there are any violations.

The data model consists of two tables connected with an ID and the date as the key. Both tables use the same dimensions and codes, but those fields cannot be connected (because of a consequential multiplication of the data).

Here a simplified example of the problem:

Qlik Community1.png

 

The following formula works fine, if an ID is selected:

sum(if($(='['&$(vField)&']')= CODE, MEASURE))

vField = FIELD

Qlik Community2.png

 

However, the goal is to show all the IDs in the same table without a selection (therefore, set analysis is not an option).

How does the formula need to be changed to acchieve this?

Thank you very much for your help.

5 Replies
Hatus
Partner - Creator II
Partner - Creator II

Very interesting! Hope to see the suggestions.
tresesco
MVP
MVP

How do you define the variable? Could you share your sample app?
Meret
Partner - Contributor II
Partner - Contributor II
Author

Hi  Tresesco

Thanks for the fast response. 

The variable is defined as:

vField = FIELD

You can find the app in the attachment.

tresesco
MVP
MVP

Ideally I would resolve this in the data model. However, check if the below expression helps:

sum(if(DIM1= CODE or DIM2= CODE, MEASURE)) 

Meret
Partner - Contributor II
Partner - Contributor II
Author

Thanks for your solution.

Sorry, the example was not clear enough.  There is an updated app in the attachment.

In the real app this approach does not work, because the values in the field CODE are not unique. For example, '100' is also used in other dimensions (see DIM3 in the updated app), where it stands for another criteria.

Also, there are nine different dimensions in the real application and in the future, there may be more, so the field must be  kept variable.