Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
egbert_jones
Contributor II
Contributor II

Bucket with else condition to include everything

Probably over complicating this but I have an if statement as such :

 

if ( Sales >0 and Profit=0), Bucket_1,

  if ( Sales=0 and Profit=1), Bucket2,

    Bucket3 ) as My_Field

The issue is that Bucket 3 will the show whatever is not included in bucket 1 and bucket2. However instead I want Bucket 3 to show everything ie a total of everything before it is bucketed rather than what's left over.

2 Replies
jwaligora
Creator II
Creator II

You probably want a separate field for the "Everything" bucket.

My_Field can't be both a subset and a superset all in one.

What about:

if (Sales > 0 and Profit = 0, 
    Bucket_1, 
    if (Sales = 0 and Profit = 1, 
        Bucket_2, 
        Optional_Leftovers_Bucket
    )
) as My_Category_Field,
Bucket_3 as My_Totals_Field,

...Your buckets are calculations, not just labels, yes?

Brett_Bleess
Former Employee
Former Employee

Did Joanna's post help you get things working as you wished?  If so, please be sure to give her credit by clicking the Accept as Solution button on her post.  If you used a different solution, you can post that as well and mark it such that others can learn from things.  

Lastly, if you are still looking for things, here is a Design Blog post that might help:

https://community.qlik.com/t5/Qlik-Design-Blog/Buckets/ba-p/1463216

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.