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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
micheledenardi
Specialist II
Specialist II

Help to create hierarchy field

Hi experts,

i've got a simple table like below where i've stored a list of numbers.

Tab1:

Number
1
2
3
4
5
6
7
8
9

I want to create one new field in order to use as filter where if i select:

  • "All numbers equal minors of 2" my Tab1 filters 1 and 2 numbers;
  • "All numbers equal minors of 5" my Tab1 filters 1,2,3,4 and 5; 
  • And so on

How to achieve this by using an elegant solution ? Maybe hierarchy() function could be the correct way but i didn't understand how to write the code...

Thanks

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.
1 Solution

Accepted Solutions
Digvijay_Singh

The same logic works but you may like to have ID field in case real data is bit more complex.

View solution in original post

4 Replies
YoussefBelloum
Champion
Champion

Hi,

you can try this:

pick(match(-1,Number>=1 and Number<=5,Number>5 and Number<=9), 'All numbers equal minors of 5','All numbers equal minors of 9') as label


PFA

Digvijay_Singh

Not an elegant one but simple solution specific to your sample problem, not sure if actual data is complex then this -

Capture.PNG

micheledenardi
Specialist II
Specialist II
Author

How can i do the same things if my Tab1 contains text and not numbers ?

Es:

Tab1:

Header 1
Group A
Group B
Group C
Group D
Group E
Group F
Group G
Group H
Group I


So:

  • if i select "Group C" my table Tab1 shows Group A, Group B and Group C.
  • if i select "Group F" my table Tab1 shows Group A, Group B, Group C Group D, Group E and Group F.
Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.
Digvijay_Singh

The same logic works but you may like to have ID field in case real data is bit more complex.