Announcements
You can succeed best and quickest by helping others to succeed. Join the conversation.
cancel
Showing results for
Did you mean:
Partner - Creator II

## Conditional expression based on different dimension attributes

Hi,

I have a table with the following information:

Dimension | Attribute | Value

A                    | 1                  | x

B                    | 2                  | 100

C                    | 2                  | 200

D                    | 3                  | 50

Where attribute and value are expressions. I need that for dimension with attribute=1, value being calculate upon the sum of values where attribute=2. In this case, x should be equal to 300.

I am trying with the following expression:

if(attribute=1, sum({1<attribute={2}>} value), sum(value))

However, I am getting x=0. I have not worked with Qlik for some time and I might be missing some very straightforward point. Can you please help?

João

Labels (2)

• ### Set Analysis

1 Solution

Accepted Solutions
MVP

Hi,

You can assign the value in the variable and use it in the expression like

vAttribute1 = Sum({1<Attribute={2}>} Value)

if(Attribute=1, \$(vAttribute1), sum(Value))

Hope it helps

Output:

Thanks & Regards, Mayil Vahanan R
3 Replies
MVP

Hi,

You can assign the value in the variable and use it in the expression like

vAttribute1 = Sum({1<Attribute={2}>} Value)

if(Attribute=1, \$(vAttribute1), sum(Value))

Hope it helps

Output:

Thanks & Regards, Mayil Vahanan R
Partner - Creator II
Author

Thank you! It solved the problem.

Contributor

Hi MayilVahanan,

I have similar question. I have the following table, where I would like the scenario A to take numbers from scenario B.

Scenario | Value

A                    | 0

B                    | 200

C                    | 250

D                    | 300

So as a result, scenario A would return 200.

I used your logic as a new expression but did not work. Rather scenario A remained 0 and scenario B remained 200.Might you have any idea how I may do that?

Community Browser