Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Count the number of parent records that have the same number of child records

Hi,

I have two tables in my datamodel - one holds booking level information, the other the item level information within that booking. A booking can have multiple items, so one record in my BOOKING table could be linked to multiples in my ITEM table, via an associated reference.

What I need to produce is a chart showing how many bookings have 1 item, how many have 2 etc.

Any ideas?

Thanks,

Rory.

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi,

see attached qvw. Hope this helps!

Best Regards

Stefan

View solution in original post

6 Replies
Anonymous
Not applicable
Author

Hi,

depending on your data structure you can use a bar chart or straight table with dimension BOOKING and with an expression Count(Items).

better for performance would be:

Sum(ItemCount)

For the last expression create a new field in your item table:

1 as ItemCount

But as I said this depends on your data structure. Please provide a sample app or a screenshot of your data model, this would help.

Best regards

Stefan

Not applicable
Author

Hi Stefan,

I'll try and produce a small example file later and post. In response to your reply though - that would work if I want to get the number of items per booking. What I want to get is the number of bookings per number of items:

BOOKING:

BOOKINGID, DETAILID

1, A

2, B

3, C

4, D

5, E

6, F

ITEMS:

DETAILID, DESC

A, ITEM 1

B, ITEM 2

B, ITEM 3

C. ITEM 4

D, ITEM 5

D, ITEM 6

E, ITEM 7

F, ITEM 8

F, ITEM 9

F, ITEM 10

So would expect results like:

No Of Items, No Of Bookings

1, 3 (Being Bookings 1, 3 and 5)

2, 2 (Being Bookings 2 and 4)

3, 1 (Being Booking 6)

As I say, will put up a small example file later.

Thanks,

Rory

nikhilgandhi715
Contributor III
Contributor III

Hi Rory,

Attached is a sample file as per the data you have mentioned above. I am not sure if this is what your requirement is; howver tried something. Hope so it helps.

Regards,

Nikhil.

Anonymous
Not applicable
Author

Hi,

see attached qvw. Hope this helps!

Best Regards

Stefan

MarcoWedel

Hi,

one solution could be also:

QlikCommunity_Thread_137923_Pic1.JPG.jpg

QlikCommunity_Thread_137923_Pic2.JPG.jpg

QlikCommunity_Thread_137923_Pic3.JPG.jpg

hope this helps

regards

Marco

MarcoWedel

or as tables:

QlikCommunity_Thread_137923_Pic4.JPG.jpg

QlikCommunity_Thread_137923_Pic5.JPG.jpg

hope this helps as well

regards

Marco