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: 
Not applicable

Dimension limits to specific values + show others

Hello

In a stacked bar chart (and in a pie chart) where there's one dimension with many possible categories (e.g. dimnesion = "Products", categories: "House","Beauty","Bathroom"...), is there a way to limit the presentation to specific categories you define (e.g. House and Bathroom) and show "Others" as well (as you would in a normal dimension limits option).

What I did was to just define the categories I wanted in the expression of the chart, but this way I can't show the total for the others...

Thanks for your help!

10 Replies
Not applicable
Author

Hi,

a calculated dimension may help, try this:

if( Products =  'House' or Products = 'Beauty' or Products = 'Bathroom', 'Others')

HtH

Roland

Sorry: better is this:

if( Products =  'House' or Products = 'Beauty' or Products = 'Bathroom', Prducts, 'Others')

Anonymous
Not applicable
Author

Roland,

Your answer is correct, but there is a shorter way using match() function.  And, posibly aggr() is needed too:

aggr(if(match(Products,'House','Beauty','Bathroom', Products, 'Others'), Products)

Regards,

Michael

Not applicable
Author

Hi Michael,

you are right, forgot about this shorter way.

But I don't see the aggr()-fanction to be used. There are no aggregations to be done.

Regards

Roland

Anonymous
Not applicable
Author

Agree, in this case it should work without aggr, so I said "possibly".  So, this should be enough:

(if(match(Products,'House','Beauty','Bathroom', Products, 'Others')

(Just a habit, in my cases aggr is almost always needed.)

Regards,

Michael

Not applicable
Author

Michael, Roland - thanks a lot for your replies.

Michael - are you sure this is the right syntax? (what you wrote in your last message)

I get error in calculated dimension

when i try to close the last parens I get the curly red line underneath it, and when I don't - the first parens is highlighted in red. Very confusing.

Thanks again

Anonymous
Not applicable
Author

I always mess the '()'...  This should work:
if(match(Products,'House','Beauty','Bathroom'), Products, 'Others')

Not applicable
Author

Let me answer, Michael won't be angry.

His expression is missing a ') ' after 'Bathroom' -->

if(match(Products,'House','Beauty','Bathroom'  )  , Products, 'Others')

So long

R

Not applicable
Author

Oh, lost 😉

Anonymous
Not applicable
Author

I'm never angry