Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
kinjal1645
Creator
Creator

Dynamic category based on selection

Hi,

Is it possible to create dynamic category base on user selections?

Capture.PNG

In above example,  I have hard coded "Other" category for Products D,E,F

But my requirement is - For example:

If user selects Product A, B then rest of the possible products should come under category "Other"

If user selects A, D, C then rest of the possible products should come under "Other"

 

Kindly help! 

@sunny_talwar @swuehl   @Gysbert_Wassenaar @tresesco 

 

Thanks

 

Labels (4)
1 Solution

Accepted Solutions
sunny_talwar

Here is another option

Create an inline table like this

Dim:
LOAD * INLINE [
    Dim
    1
    2
    3
];

and then this

Dimensions

=Pick(Dim, 'Revenue','Income','Expense')
=Aggr(If(Product = Only({1} Product), Product, 'Others'), Product)

Expression

Pick(Only(TOTAL <Dim> {1} Dim),
  Sum({<Product>}Revenue),
  Sum({<Product>}Income),
  Sum({<Product>}Expense)
)

View solution in original post

4 Replies
Frank_Hartmann
Master II
Master II

see attached qvw

hope this helps

tresesco
MVP
MVP

Calculated dimension:

Aggr({<Product>} Only({<Product>}If( Index(GetFieldSelections(Product, '|'),Product) Or Len(GetFieldSelections(Product))=0,Product, 'Others')),Product)

Expression:

sum({<Product>}Revenue)

sunny_talwar

Here is another option

Create an inline table like this

Dim:
LOAD * INLINE [
    Dim
    1
    2
    3
];

and then this

Dimensions

=Pick(Dim, 'Revenue','Income','Expense')
=Aggr(If(Product = Only({1} Product), Product, 'Others'), Product)

Expression

Pick(Only(TOTAL <Dim> {1} Dim),
  Sum({<Product>}Revenue),
  Sum({<Product>}Income),
  Sum({<Product>}Expense)
)
kinjal1645
Creator
Creator
Author

Thanks Frank, Tresesco, Sunny