Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

AutoCollapse Item (based on a condition)

Hi all, one question not too simple to explain. I have some pivot chart with a tree structure:

A: 8 (5+3)
Aa: 5 (1+2+2)
Aa1: 1
Aa2: 2
Aa3: 2
Ab: 3

B: 1
Bb: 1
Bb1: 1

C: 11 (7+4)
Cc: 7 (3+4)
Cc1: 3
Cc2: 4
Cb: 4 (1+3)
Cb1: 1
Cb2: 3

now.. that's a normal pivot... but I have also some level calculated starting form other ones (eg.: D = C-A-B) for which I created the single row multiplied per +1 or -1 depending on the sign.
Every record created has a flag set to 1 that indicates that this is a calculated record. In this way I can recognize them. So in the pivot table where the sum of this flag is >0 I can put the description of the level and his value in BOLD.

It works fine, but now I want to collapse automatically the calculated level (the D level in this case), cause when I design the pivot the D level is expanded per default, like the other ones. So I have this situation:

A: 8 (5+3)
Aa: 5 (1+2+2)
Aa1: 1
Aa2: 2
Aa3: 2
Ab: 3

B: 1
Bb: 1
Bb1: 1

C: 11 (7+4)
Cc: 7 (3+4)
Cc1: 3
Cc2: 4
Cb: 4 (1+3)
Cb1: 1
Cb2: 3

😧 2 (11-1-8) [Line Calculated, below all the addend expanded per default]
Aa: -5
Aa1: -1
Aa2: -2
Aa3: -2
Ab: -3
Bb: -1
Bb1: -1
Cc: +7
Cc1: +3
Cc2: +4
Cb: +4
Cb1: +1
Cb2: +3

There's a way to do this for example with a macro? I've tried with "ExpandLeft" and "CollapseLeft" but my fault is that I cannot tell to QV the items that have to be collapsed and the ones that should remain expanded.

This is the result I want to obtain:
A: 8
Aa: 5
Aa1: 1
Aa2: 2
Aa3: 2
Ab: 3
B: 1
Bb: 1
Bb1: 1
C: 11
Cc: 7
Cc1: 3
Cc2: 4
Cb: 4
Cb1: 1
Cb2: 3
D (Collapsed): 2

I hope it's clear.

Thanks



Labels (1)
1 Reply
Not applicable
Author

Some ideas?