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

combine separate dimensions in layout

Hi guys,

Here's a simplified example of the question I have:

Here's my script:

sales:
load * inline
[
Item, Qty
A,1
B,2
C,3
];

color:
load * inline
[
Item, Color
A, Red
B, Yellow
C, Blue
];

sales:
load * inline
[
Item, Shape
A, Round
B, Square
C, Triangle
];

I'm summarizing item sales by different dimensions:

1. By color

1111111.PNG

2. By shape:

2222222.PNG

But user wants to combine all dimensions in one table. So this is what I tried: 

Field: =IF($Field='Color' or $Field='Shape', $Field)

Value: =Pick(Match($Field, 'Color', 'Shape'), Color, Shape)

Qty: =SUM(Qty)

And here's the result:

3333333.PNG

But the problem is: user is not able to filter. For example: If I select "Red", then clear it, "Shape" will disappear, only "Color" left.

 

Any better idea to achieve this? This is just a simple example, my real model is much more complex, so I would rather do it from layout, not script, in order to avoid some circular reference issues.

 

Any idea helps. Thank you in advance!

Labels (1)
1 Solution

Accepted Solutions
Vegar
MVP
MVP

Maybe adjusting the expression to this would help?

=SUM({<$Field>}Qty)

(See attached qvf) 

View solution in original post

5 Replies
Gopi_E
Creator II
Creator II

give exact what type of filters you want

Vegar
MVP
MVP

Any selection in dimension or field will make a selection in the hidden field $Field. Try using only({1}$Field) in your conditional statements.

wanyunyang
Creator III
Creator III
Author

I would like to choose values from both attributes, for example, both "Blue" and "Triangle".

wanyunyang
Creator III
Creator III
Author

Hi Vegar, thank you for the reply! Is it possible I could choose from both attributes?

Vegar
MVP
MVP

Maybe adjusting the expression to this would help?

=SUM({<$Field>}Qty)

(See attached qvf)