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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
cgT
Creator
Creator

Grouping by Values

Hi everyone,

I'm trying to create a break down of booking group sizes. I want to group each booking (BooRefNo) by the number of seats sold into it (SoldSeats). So I end up with, for example:

Group size          Count

1                                 50

2                                 220

3                                 140

etc... (numbers are examples, of course) any bookings with more than 10 tickets will be listed as '10+'.

 

this is what I have so far in my expression:

=if(sum(SoldSeats)<= 10,
Count({<SoldSeats = {"$ (=Sum(SoldSeats))"} >} BooRefNo),
Count({<SoldSeats = {">10"}>} BooRefNo))

 My dimension is as follows:

=if(sum(SoldSeats) <= 10, sum(SoldSeats), '10+')

However, I'm just returning a blank table...

Thanks in advance for your help! 

Labels (1)
1 Reply
cgT
Creator
Creator
Author

So  an update on this... I have noticed that my (now updated) expression is not aggregating SoldSeats by BooRefNo, so this means that if, say, 2 seats are sold on a booking line within the entire booking and 3 are sold on another, then it lists them in both the '2 tickets' category and the '3 tickets' category. I want the expression to sum any SoldSeats where the BooRefNo's match. This is what I've tried:

 

=if(sum(SoldSeats) <= 10,
Count({<SoldSeats = {'$(=Aggr(Sum(SoldSeats), BooRefNo))'} >} BooRefNo),
Count({<SoldSeats = {'$(=Aggr(Sum(SoldSeats), BooRefNo))'}>} BooRefNo))

 Please help!

 

Thank you